views:

15

answers:

2

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).

A: 

At a guess, it's probably failing to jump to Scene 2 in cases where that frame hasn't loaded yet - try testing it in the IDE with simulated loading (press ctrl+Enter twice) to be sure. If that's the problem, try adding a preloader until the frame you want (or the whole movie) is loaded. (See sample code here.)

fenomas
A: 
fabieno