ActionScript 2.0 :: Button To Switch The Variable Off

Dec 17, 2003

Here's a really easy (Not so easy for me) question for you. First person to answer rules the. I have a button that switches a variable from 0 to 1.

on (press) {
_root.pageone = 1;
}

I want the same button to switch the variable off. I've been trying "if else", but my syntax is rubbish. How do I code this statement On Press Button > if _root.pageone = 1 change to 0 > if _root.pageone = 0 change to 1.

View 2 Replies


Similar Posts:


CS3 :: Create A Different Object Of The Same Variable Name With The Switch Statment?

Oct 20, 2009

I just started in as3 after a long break from flash and I have run into a slight problem and couldn't find any readily available solutions online so I thought I'd ask, I'm trying to do something like this:

Code:

switch(characters[ps[1]])
{
case 0:

[code]....

I want to create a different object of the same variable name with the switch statment but it gives me "1151: A conflict exists with definition player in namespace internal" which is of course because I'm redeclaring the variable. I'm not 100% sure it technically exists in the current scope though (but it must because I am getting this error.) I also tried a few ways of initializing as just MovieClip up topside and then just try and typecast it down here but as can be assumed that didn't work either.

Is there a way to get my intended effect or am I gonna have to make some like an above class containing all these other classes on it's various frames and just instantiate those?

View 3 Replies

ActionScript 3.0 :: Accessing A Static XML Variable From Within A Switch Statement

Jun 1, 2009

In the following class

Code:
package
{
public class Factory
{

[Code]]....

A break point on the "Okay" line shows that x1 is null but x2 is equal to "<entity id="DRONE" points="100"/>".

If I take the whole block out of the switch statement, both x1 and x2 are equal to the expected xml.

View 6 Replies

ActionScript 3.0 :: Switch A Boolean Variable To True After A Mouse Click On A Movieclip?

Sep 2, 2011

I am trying to switch a boolean variable to true after a mouse click on a movieclip.

I want an animation to continue after the user has clicked both btn1 and btn2.

After researching this topic it appears that changing a variable inside a function will only effect code within that function and not the code outside of it - therefore my main Btn1Var and Btn2Var do not update to flase.

ActionScript Code:
stop()
var btn1Var:Boolean = false;
var btn2Var:Boolean = false;

[Code].....

Is there an easy way to change the original variable for each button to true after being clicked?

View 5 Replies

ActionScript 2.0 :: [CS3] : Making A Switch (button)?

Feb 18, 2009

I have made a button to function like a switch in that it has both an on and off state. However, I can only get it to switch between the on and off state once when it's pressed, with nothing happening after it has been turned off.The code is as follows:

Code:
switch1.onPress = function() {
switch1.gotoAndStop("on");
_root.onEnterFrame = function() {

[code]....

is there a way to make it so that the switch works continuously, not just one time?

View 1 Replies

ActionScript 2.0 :: CheckBox As Switch For Button On/off

Jul 23, 2011

never really used checkBoxes much and wondering what the best AS2 is to use one as a "switch" ?

i.e. place a checkbox which is default unchecked and if the user checks it {do something} and if the user then unchecks it {undo that something}.

I'm thinking about the _alpha of a button or an MC as an example / test.

Check the box: anMC = _alpha 100, unchceck the same box: anMC = _alpha 50.

I'm happy either way with code on the checkbox or an even listener on a frame (preferred) but would like to learn how to use checkBoxes as a switch.

View 2 Replies

ActionScript 3.0 :: Button To Switch On A Video?

Jun 7, 2011

I'm very basic at flash, but sofar I've created a little portfolio page with a video background as a front page. I want to add a button to the background which will turn of the current video and play another video and when the button is pushed again it will play the first video again.[URL]
 
here's my as for the videobackground:
 
import VideoBg; 
var videos:Array=new Array('videos/bird_short.f4v');
var num:uint=1;

[Code].....

View 11 Replies

ActionScript 2.0 :: Button To Switch Light On / Off

Nov 19, 2003

I am really new to Flash n Actionscript and have been dropped in to make a switch that will make a light come on in the first click and off on the second, on on the third and off on the forth etc... I have created the switch as a button and the light on/off as two movie clips....
What coding would i be looking to add to make this switch work...

Previously I have been given this... but its not working
//this is for the button (switch)
on(release) {
if (_root.light_on:active == 1) {
setProperty("_root.light on", _visible, "1");
_root.light_on:active = "0";
} else {
_root.light_on:active = "1";
setProperty("_root.light_on", _visible, "0");
}}

//This is for the light on
onClipEvent (load) {
active = "1";
setProperty("_root.light_on", _visible, "0");
}

View 7 Replies

ActionScript 3.0 :: Get Button To Switch Out From Loaded Swf

May 18, 2011

I'm a designer struggling to learn advanced actionscript. It's quite a challenge,
One of the challenge i'm having right now is: I have my main timeline(swf). i'm loading in 2 separate swfs into two separate holders on the main stage/timeline/swf. whatever it's normally called. One of the loaded swfs is a menu and the other is a page. Basically i'm designing a learning application. The menu alllows you to jump to a specific place in the course rather than a next button of sorts which is also in the course.

When a different page is loaded i need for a button(movieclip) that's located in the menu swf to swith out with a new button that's located off the stage somewhere.(these buttons are located in the menu swf off stage) so i need the loaded page swf, to talk to the other loaded swf(menu) everytime it or another page is loaded. I've seen simular references to having a loaded swf talk to the main timeline swf but i haven't been able to find a reference for two loaded swfs thats loaded inside holders, to talk to each other.

View 1 Replies

ActionScript 2.0 :: Button Switch's Light On/off?

Nov 19, 2003

n Actionscript and have been dropped in to make a switch that will make a light come on in the first click and off on the second, on on the third and off on the forth etc... etc...

i have created the switch as a button and the light on/off as two movie clips... what coding would i be looking to add to make this switch work...

previously i have been given this... but its not working
//this is for the button (switch)
on(release) {
if (_root.light_on:active == 1) {

[Code]....

View 7 Replies

ActionScript 3.0 :: Switch A Video To Fullscreen From A Button ?

Jul 29, 2010

What is the best way to switch a video to fullscreen from a button in AS3? Like the fullscreen button in FLVPlayback component - I'm aware the FullScreen tag needs to go into the HTML...

View 1 Replies

Professional :: Switch Between The Normal And Over-states After The Button Is Clicked?

Jan 30, 2010

I'm pretty new to this and racking my brains on the following problem: I have a movieclip-button, with 3 states (normal, over and clicked). I want to disable the functions in actionscript 3 that switch between the normal and over-states after the button is clicked, and not enable these functions for this button until another button is clicked. What's the best/ simplest way to do this?

View 5 Replies

ActionScript 3.0 :: Switch In A Full Screen Mode Without A Button?

Jan 25, 2011

Is there a way to switch in a full screen mode without a button?
 
I tried like this but it's not working:
 
function setFullScreen():void {    if (stage.displayState=="normal") {        stage.displayState="fullScreen";        stage.scaleMode=StageScaleMode.NO_SCALE;    } else { 

[Code]....

View 1 Replies

ActionScript 2.0 :: Button Switch IF Statement For Video Player?

Oct 2, 2008

I am working on a video player that will have different Languages. The problem that i am have is that i can get the video to switch but i cant get the video to switch back. I have uploaded the file and here is the code that i have have a problem with.

lang.onRelease = function() {
if  play = English)
{

[Code].....

View 1 Replies

ActionScript 1/2 :: Button Type Toggle To Switch Fullscreen Ad Back

Jul 22, 2010

Any reliable full screen code for actionscript 2.0. I have search but can't get any thing that works proper. I just need a button type toggle that switches the screen to full screen and back.

View 1 Replies

ActionScript 2.0 :: [Flash8] External File - Button To Switch Between Backgrounds

Mar 9, 2006

I'm making a flash banner for a client, it has a button to switch between backgrounds, however, how do I say something like

[Code]...

View 7 Replies

ActionScript 2.0 :: Make A Simple SWITCH Statement With Button._name As Variables?

Jun 18, 2007

I want to make a simple SWITCH statement with Button._name as variables for CASE

so i got this code:

Code:
Button.addListener(_root);
_root.onRelease = function() {

[Code]....

View 2 Replies

ActionScript 2.0 :: Make Movie Clip Randomly Switch Colors With Push Of Button?

Jul 7, 2004

I want to implement having a movie clip randomly change color.How can I make my movie clip randomly switch colors with a push of a button??By the way I'm using flash MX and I am still intermediate when it comes to coding.

View 3 Replies

ActionScript 3.0 :: Create A Variable And Get The Button To Add One To That Variable?

Jan 28, 2010

I want to be able to have a number displayed on the screen that when one of the arrows next to it (up/down) is clicked it adds 1 to the original number (lets say 72). Then when they click the "save" button that really just takes them to the next frame (or a frame somewhere else in the movie), which is a confirmation page, I want the number they ended at to display on the confirmation screen.
I'm thinking that it is partially because I don't know what to search for.I know I have to create a variable and get the button to add one to that variable.

View 2 Replies

ActionScript 3.0 :: Switch / Case And Nested Switch / Case

Oct 30, 2011

What I'm trying to do is create a program that, depending on 2 variables, multiplies another variable by a static number. Heres the code I have so far:

[Code]...

View 1 Replies

ActionScript 2.0 :: Can Default From Switch/case Be Used In Another Switch/case

Dec 10, 2003

I want this on an MC:

[AS]
i = 0;
switch(thing){
case 0:

[code]....

Basically what I'm wondering is, will I lose the value of i in the first switch once I'm out of the switch? Can the second switch read the 1st switch?

View 8 Replies

ActionScript 3.0 :: Switch/Case And Nested Switch/Case?

Oct 29, 2011

Im trying to create a program that, depending on 2 variables, multiplies another variable by a static number. A friend suggested I use case/switch instead of if/else statements,which is what I was using before.

[Code]...

View 1 Replies

ActionScript 2.0 :: Set A Variable On A Button (the Button Is On Level 5)?

Dec 4, 2003

i was wondering if i set a variable on a button (the button is on level 5)

Code:
_level5.current_selection = "credits"

and i would like the movie on level 1 to recognize that this button (on level 5)has been pressed,is this script correct on an empty keyframe in level 1.

Code:
_level5.current_selection = "credits";
if (_level5.current_selection == "credits") {
loadMovieNum("credits.swf", 2);

[code].....

i've tried this and it isn't recognizing the variable.

View 1 Replies

ActionScript 2.0 :: Button Set Variable Value?

Jul 24, 2010

I have a mc button which when click should set the variable associated with it. Here is the code I have on the first frame of the AS2 MC Button, the idea is when clicked this button sets q1a to 30 and q1b and q1c to 0 so when the SUBMIT button on main timeline is click it advance to next frame on with dynamic text and appropriate variable label on the main timeline.

clicked=false;
over=false;
this.onRollOver=function(){

[code].....

View 5 Replies

ActionScript 3.0 :: Use Button To Set A Variable?

Dec 10, 2011

I would like to use a couple of buttons that I made to set a variable. I'd like to use the instance name of the button(s) as the value stored as the variable. how can i code this?

View 3 Replies

ActionScript 2.0 :: Set A Variable On A Button?

Dec 4, 2003

i was wondering if i set a variable on a button (the button is on level 5)

Code:
_level5.current_selection = "credits" and i would like the movie on level 1 to recognize that this button (on level 5)has been pressed, is this script correct on an empty keyframe in level 1.

Code:
_level5.current_selection = "credits";
if (_level5.current_selection == "credits") {
loadMovieNum("credits.swf", 2);

[Code]....

i've tried this and it isn't recognizing the variable.

View 1 Replies

ActionScript 3.0 :: Variable Button Is Not Defined?

Jul 3, 2009

I'm making a contact form, and I keep getting two errors when I try previewing it in a web browser.

ReferenceError: Error #1065: Variable Button is not defined.
ReferenceError: Error #1065: Variable ComponentShim is not defined.

I don't know what these errors mean. Can anyone give me an explanation? I am using Flash CS4 with ActionScript 3.0. The first function is for the contact button to go to the contact page. The code following is the code for the contact form.Here is my code for the contact form:

Code:
function onContactClick(e:MouseEvent):void
{
gotoAndStop("contact");[code]............

View 6 Replies

ActionScript 1/2 :: Change A Variable By Button?

Dec 12, 2011

I need to change one variable at the click of a button the problem is that when I enter the first frame i declared a _global var _global.conteudo =null;
 
In the second frame:
this equal a _global to :
_global.conteudo = "enterprise.swf";
 
But  when I click a button , i need change my _global var  for example:
 
on (release){_global.conteudo="my variable declared";}

View 18 Replies

ActionScript 2.0 :: Set A Variable When That Button Is Clicked

Apr 14, 2008

I'm working on a game, where if you click an answer, it will double check to see if that's the one you really want. So I tried to set a variable when that button is clicked. On another set of buttons, I placed an if / else statement, but it doesn't seem to be working.[code]

View 2 Replies

ActionScript 2.0 :: Button Name Controlled By Variable?

Mar 13, 2009

I have several buttons I need to turn on and off (visibility and alpha) but the function I have written that determines if a given button should be turned off works based on a few variables. I need to be able to control which button is turning on and off with these variables.

I have tried this ("btn" + i)._visible or alpha but does not work. how I can accomplish this?

View 11 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved