- Create image placeholder movie
- Add image placeholder movie on stage, name it "image_placeholder"
- Click on the first frame of the default layer and add the following:
var myLoader:Loader = new Loader(); myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady); var fileRequest:URLRequest = new URLRequest("photo.jpg"); myLoader.load(fileRequest); function onProgressStatus(e:ProgressEvent) { trace(e.bytesLoaded, e.bytesTotal); } function onLoaderReady(e:Event) { image_placeholder.addChild(myLoader); } stop();
Flash: Dynamically Load Image in ActionScript 3.0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment