Flash AS3: Loading bar not finished when movie starts playing
- by flashey
Hi,
I'm using the same code I always use for preloading another swf but it's not working this time. The problem this time is that when the loading bar gets to 16% every time you can hear the movie I'm loading playing in the background. I can just add a stop to the first frame of the movie I'm loading ("trial_1.swf") but how do I tell it to go to the second frame once it has loaded?
Any help is much appreciated!
Here's my code:
var myrequest:URLRequest=new URLRequest ("trial_1.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
myloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progresshandler);
function progresshandler(myevent:ProgressEvent):void {
var myprogress:Number=myevent.target.bytesLoaded/myevent.target.bytesTotal;
bar_mc.scaleX=myprogress*1.5;
myTextField_txt.text = Math.round(myprogress*100)+"%"
}
myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, finished);
function finished(myevent:Event):void {
addChild(myloader);
removeChild(myTextField_txt)
removeChild(bar_mc);
removeChild(logo_mc);
}