Flash load image sample
February 11th, 2010
Actionscript 3.0:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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)+"%)"; } |


May 26th, 2010 at 4:24 am
You are a very smart person!