AS2 acts randomly when changing scenes on the first frame
- by fabieno
I have a flash movie containing to scenes: scene1, scene2.
I have chosen the order so that scene1 starts first, I was requested to add a functionality to allow flashvars to be passed, if fv_change equals one then scene2 should be the first to appear when the movie is loaded.
I have included the following code in scene1 first frame of some layer:
this.onEnterFrame = function() {
delete this.onEnterFrame;
if (isset==undefined && _root.fv_change && _root.fv_change==1) {
isset = true;
gotoAndStop("scene2",1);
}
}
when testing in my flash environment everything worked fine, when I exported it to an HTML & SWF combo I got random results, I refreshed the page several times and some of the times scene2 appeared and some of the times it stayed with scene1.
Am I doing something wrong? what is the correct way to change scene order using AS2 and external data(flashvars for that matter).