|
-
[RESOLVED] Need help with AS2 button and variable
I have a button called "btn01" on main timeline with the following actionscript;
btn01.onRelease = function() {_root.map_mc.gotoAndStop("map01");}
I also have a map on the maintimeline with 50 state buttons with the following actionscript;
on (release) {
_root.gotoAndPlay(3);
_root.mc_allstates.gotoAndStop("Washington");
_root.state_no=0;
A_fg_allstates.gotoAndStop("Washington");
state_now="Washington"
trace (state_now);
}
I have a declared variable "state_now" that gets updated when the above buttons are clicked with current State Name. I have traced it and it is working.
On the main timeline is a MC "A_fg_allstates" with 50 key frames labeled all 50 of the US states. What I need is to get btn01 to advance to the labeled frame in A_fg_allstates using the variable populated by clicking the state button above.
Hope that makes sence, basically how do I use a variable to define the labeled frame in a MC to advance to on click.
-
.
Hi,
PHP Code:
on (release) { _root.gotoAndStop(state_now); }
without seeing it that is
-
Not sure how this gets coded but here is what I am thinking;
Code:
btn01.onRelease = function() {
_root.map_mc.gotoAndStop("map01");
A-fg_allstates.gotoAndPlay("state_now");
}
-
Hey Fruitbeard gald you are online hope life is good buddy
-
so when using a variable as above the proper syntax is without parenthesis?
A-fg_allstates.gotoAndPlay(state_now);
NOT
A-fg_allstates.gotoAndPlay("state_now");
Sorry first time I have ever used variable in defining button click actions
-
.
yes, inside of "" makes it a name, if you follow.
-
does the same sytax rule apply to assiging a value to the variable on click ie
state_now="Alaska"
or
state_now=Alaska
-
sorry but this scope issue has me really stumped. What version of Flash are you using? Would like to send you the complete file but in 5.5 is 10mg and 4.0 its 20 mg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|