Hi all, am trying to do a multiple if statement checking to determine which frame label within a MC (NE) and is located on frame 3 of the main timeline, to display.
In the main timeline frame 1, I have declared a new var:
var n_e;
button1.onRelease = function (){
n_e1 = 1;
main timeline go to and stop at frame 3
}
button2.onRelease = function (){
n_e1 = 2;
main timeline go to and stop at frame 3
}
On Frame 3 where the NE movieclip is, i did a onload event on the clip itself:
NE.onLoad = function() {
if (n_e1 == 1) {
this.gotoAndStop("1");
}
if (n_e1 == 2) {
this.gotoAndStop("2");
}
}
But it doesnt seem to work, and most of the time it lands up on Ne("2") instead...
Would appreciate any kind suggestions to resolving this. Thanks in advance!
Yes, well, basically you've got a path problem. When you put code inside an mc, this works for that mc's timeline. So to access the n_e variable that is located on the _root, you need to go to it by _root.n_e
I have uploaded the fixed solution.
Keep also in mind, that once the movie clip has loaded, the onLoad() event will not trigger anymore...
Also as a side help, instead of declaring a label for each frame called 1, 2, 3 and accessing them by telling the script gotoAndStop("1") you could remove the label names and just tell the script to gotoAndStop(frame_number) ... without the quotes... like: gotoAndStop(2);