Adding an asset to the display list
package {
import flash.display.*;
import flash.net.URLRequest;
import flash.events.*;
public class Main extends Sprite {
private var loader:Loader;
public function Main() {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
var urlRequest:URLRequest = new URLRequest("sunset.jpg");
loader.load(urlRequest);
}
private function initListener (e:Event):void {
addChild(loader.content); // Add Bitmap object to SunsetViewer
}
}
}
Related examples in the same category