This wee preloader script from I<3 actionscript works a treat:
import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; function startLoad() { var mLoader:Loader = new Loader(); var mRequest:URLRequest = new URLRequest(“MouseActions.swfâ€); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); mLoader.load(mRequest); } function onCompleteHandler(loadEvent:Event) { addChild(loadEvent.currentTarget.content); } function onProgressHandler(mProgress:ProgressEvent) { var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal; trace(percent); } startLoad();
http://www.iheartactionscript.com/loading-an-external-swf-in-as3/
Tech Reference: AS3
Leave a Reply