I can't get this loading bar to work with my movie. It worked pretty well when I had a music file actually on the timeline of the movie, starting on the second frame, but I have that set up through a custom class now. Currently, when I test the movie and simulate the download, the screen is blank until the loading is complete, rather than showing the progress of the load.
Here's the code I have on frame one of my movie. Pretty much everything else is in .as files.
I also tried setting up a second swf that would load the first swf into it, thinking that might solve the problem, but that's a no go. Here's the code I used for that:Code:stop(); addEventListener(Event.ENTER_FRAME, loaderF); function loaderF(e:Event):void { var toLoad:Number = loaderInfo.bytesTotal; var loaded:Number = loaderInfo.bytesLoaded; var total:Number = loaded/toLoad; if(loaded == toLoad) { removeEventListener(Event.ENTER_FRAME, loaderF); gotoAndStop(2); } else { preloader_mc.preloaderFill_mc.scaleX = total; preloader_mc.percent_txt.text = Math.floor(total*100) + "%"; preloader_mc.ofBytes_txt.text = loaded + "bytes"; preloader_mc.totalBytes_txt.text = toLoad + "bytes"; } }
Any ideas/suggestions? Maybe I'm going about this all wrong.Code:stop(); var ldr:Loader = new Loader(); addEventListener(Event.ENTER_FRAME, startLoading); function startLoading(e:Event):void { ldr.load(new URLRequest("MainGame.swf")); var toLoad:Number = ldr.contentLoaderInfo.bytesTotal; var loaded:Number = ldr.contentLoaderInfo.bytesLoaded; var total:Number = loaded/toLoad; if(loaded == toLoad) { removeEventListener(Event.ENTER_FRAME, startLoading); removeChild(preloader_mc); loader_mc.addChild(ldr); } else { preloader_mc.preloaderFill_mc.scaleX = total; preloader_mc.percent_txt.text = Math.floor(total*100) + "%"; preloader_mc.ofBytes_txt.text = loaded + "bytes"; preloader_mc.totalBytes_txt.text = toLoad + "bytes"; } }




Reply With Quote