all groups > flash (macromedia) > october 2005 >
You're in the

flash (macromedia)

group:

Referencing a Global Variable



Referencing a Global Variable NEW_Flash
10/5/2005 8:37:17 PM
flash (macromedia): :brokenheart;
Thanks for your time in Advance;

Ok, I have my flash program has 2 scenes; Main and Sub.
The main scene has 3 options (1 -2 -3)
if the user selects option 1 I have the following code inside the main scene
myVariable = 1;

if the user selects option 2 I have the following code inside the main scene
myVariable = 2;

if the user selects option 3 I have the following code inside the main scene
myVariable = 3;

Ok, so when I leave the main scene and go to Sub scene
I refernece these variable within a movie clip called mc_nav. here is the code

if (_root.myVariable == 1) {gotoAndPlay(9);
} else if (_root.myVariable == 2){gotoAndPlay(40);
} else {gotoAndPlay(70);
}

SO FAR so Good!!!

Now the problem- within scene Sub I also have 3 options and based on the user
choice I move a value into the varaible
The Code inside scene sub (is similiar to scene main code)
If the use clicked option 1 the code is
myVariable = 1;

If the use clicked option 2 the code is
myVariable = 2;

same goes for otion 3
myVariable = 3;

when I run my movie clip MC_NAV (inside scene sub)
the following code completely ignores my variable.

if (_root.myVariable == 1) {gotoAndPlay(9);
} else if (_root.myVariable == 2){gotoAndPlay(40);
} else {gotoAndPlay(70);
}

not only that the variable myVariable is all screwed up.

I'm pulling my hair out!!!!

please help me flash gurus..


Re: Referencing a Global Variable Jeckyl
10/6/2005 12:00:00 AM
[quoted text, click to view]

should be

_root.myVariable = 1;

etc
--
Jeckyl

AddThis Social Bookmark Button