Revision: 36821
Updated Code
at November 27, 2010 02:33 by adrianparr
Updated Code
import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.IOErrorEvent; var myLoader = new Loader(); myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError); myLoader.load(new URLRequest("swfToLoad.swf")); function onProgress(evt:ProgressEvent):void { var nPercent:Number = Math.round((evt.bytesLoaded / evt.bytesTotal) * 100); loadingAnim.bar.scaleX = nPercent / 100; loadingAnim.percLoaded.text = nPercent.toString() + "%"; } function onComplete(evt:Event):void { myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress); myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete); addChild(myLoader); } function onIOError(evt:IOErrorEvent):void { trace("IOError loading SWF"); }
Revision: 36820
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 27, 2010 02:27 by adrianparr
Initial Code
import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; var myLoader = new Loader(); myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); myLoader.load(new URLRequest("swfToLoad.swf")); function onProgress(evt:ProgressEvent):void { var nPercent:Number = Math.round((evt.bytesLoaded / evt.bytesTotal) * 100); loadingAnim.bar.scaleX = nPercent / 100; loadingAnim.percLoaded.text = nPercent.toString() + "%"; } function onComplete(evt:Event):void { myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress); myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete); addChild(myLoader); }
Initial URL
Initial Description
Initial Title
AS3 Track Loader Progress
Initial Tags
Initial Language
ActionScript 3