I have setup main.swf with the document class below:
package classes { import flash.events.Event; import flash.events.ProgressEvent; import flash.display.Loader; import flash.net.URLRequest; import flash.display.MovieClip; public class LoaderClass extends MovieClip { public function LoaderClass():void { var req:URLRequest = new URLRequest("content.swf"); var loader:Loader = new Loader(); loader.load(req); addChild(loader); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); } public function loadProgress(e:ProgressEvent):void { var percent:Number = e.bytesLoaded/e.bytesTotal; percent = percent * 100; MC_Loader.loader_txt.text = percent; } public function loadComplete(e:Event):void { trace("Complete!"); } } }
In the content.swf I have just chucked a hi res image just to try out the loader. The problem is it works fine when I test it in flash (Control -> Test Movie) but when I upload it to my host it doesn't work properly, loader_txt goes from 0 to 100 instantly yet the image has clearly not finished loading???
bytesLoaded and bytesTotal appear to report incorrectly inside the browser but I don't know why or of an alternative method?
Edit: It seems like bytesLoaded and bytesTotal are always the same, not sure why that is?
Edited by BlazeForc3, 06 June 2008 - 09:37 AM.