/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private function loadContent(path:String, x:Number = 0, y:Number = 0):void { var ldr:Loader = new Loader(); var url:String = path; var urlReq:URLRequest = new URLRequest(url); ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete); ldr.load(urlReq); ldr.x = x; ldr.y = y; addChild(ldr); } // callbacks private function onLoadComplete(e:Event):void { } private function onLoadProgress(e:ProgressEvent):void { var kbl:Number = e.bytesLoaded; var tkb:Number = e.bytesTotal; }