← Blog January 6, 2012

Pulling in external jpgs with AS3

BlogFlash and FlexMobile App DevelopmentactionScriptas3flashloading images

This is something I have done and forgotten so many times. So lets try add it here as a reminder.
To add an image to flash.

import flash.display.Loader;
import flash.net.URLLoader;
myImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaderReady);
var fileRequest:URLRequest = new URLRequest(“XXX.jpg”);
myImageLoader.load(fileRequest);
public function onImageLoaderReady(e:Event) {
       myContainer.addChild(myImageLoader);
}
Credits to Kirupa once again, a site with so much useful information