I have a preloader script that I’m using to load a presentation. The preloader gets to 10% and starts playing the presentation, while the preloader movie is still visible? I can’t understand why this is happening since the loader isn’t being added until the progress event is completed.
preloader_mc.stop();
preloader_mc.visible = false;
var swf:String = "test.swf";
var myURL:URLRequest = new URLRequest(swf);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.OPEN, initialize);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, inProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completed);
loader.load(myURL);
function initialize(e:Event):void {
preloader_mc.visible = true;
}
function inProgress(e:ProgressEvent):void {
var percentage:uint = (e.bytesLoaded/e.bytesTotal)*100;
preloader_mc.loader_txt.text = percentage.toString() + "%";
preloader_mc.pbar.scaleX = percentage/100;
}
function completed(e:Event):void {
preloader_mc.visible = false;
addChild(loader);
}
Any suggestions?