0
我想加載一個圖像對象並在運行時將其添加到舞臺上。我怎麼做到這一點?在Actionscript 3中加載圖像並添加到舞臺3
我想加載一個圖像對象並在運行時將其添加到舞臺上。我怎麼做到這一點?在Actionscript 3中加載圖像並添加到舞臺3
您使用加載程序。
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
有接近底部的代碼示例。
,如果它是你可以使用這個外部圖像:
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);
}
你有什麼這麼遠嗎? – 2009-12-02 14:55:23