So I have a looping SWF file that I uploaded on my website. It played perfectly until I decided to add a preloader.
I set up the Flash file with 2 Scenes, “Preloader” and “Scene 1” .The Preloader scene will play just fine. After the preloader plays, Scene 1 then begins to play as it should. However, once the animation ends, instead of looping like it did before, it just stops on the first frame.
How can I get my SWF to play the Preloader, and then continue looping the main animation (Scene 1)?
Here is my AS:
import flash.events.ProgressEvent;
function update(e:ProgressEvent):void
{
var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );
if(preloaderMC is MovieClip){
preloaderMC.gotoAndStop(percent);
}
if(percent == 100){
play();
}
}
loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
// Extra test for IE
var percent:Number = Math.floor( (this.loaderInfo.bytesLoaded*100)/this.loaderInfo.bytesTotal );
if(percent == 100){
nextFrame();
}
stop();
I received a reply on another forum that said to do the following but I am not quite sure how to do this:
After loading is complete and you return to your first frame, your stop() is executing immediately after your nextFrame(). so flash won’t advance frames.
To remedy, use a boolean to determine if that frame has played once and if yes, don’t execute that stop(). Use a boolean to determine if that frame has played once and if yes, don’t execute that stop().
Any help is appreciated!