I want to load an image object and add it to the stage at runtime. How would I accomplish this?
A:
You use a Loader.
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
There's a code example near the bottom.
David
2009-12-02 14:55:21
+2
A:
if it's an external image you would use this:
var loader:Loader = new Loader();
loader.load(new URLRequest("http://urltoyourimage.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
function onCompleteHandler(event:Event):void
{
event.target.removeEventListener(Event.COMPLETE, onCompleteHandler);
addChild(event.target.content);
}
daidai
2009-12-02 15:08:48