function loadImage(img:String) {
var pictLdr:Loader = new Loader(); var pictURL:String = img; var pictURLReq:URLRequest = new URLRequest(pictURL); pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadedF); pictLdr.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, preloader); pictLdr.load(pictURLReq); myImage.addChild(pictLdr); } function imgLoadedF(event:Event):void { myStroke.width = myImage.width; myStroke.height = myImage.height; //trace("loaded"); } function preloader(event:ProgressEvent):void { var pcent:Number=event.bytesLoaded/event.bytesTotal*100; myText.text = "loading ("+int(pcent)+"%)"; } |
|