是否有任何开源flash / actionscript代码可以显示x秒的图像。
答案 0 :(得分:1)
var ldr:Loader;
var timer:Timer;
function showImage(url:String, seconds:Number):void
{
ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
ldr.load(new URLRequest(url));
timer = new Timer(seconds * 1000, 1);
timer.addEventListener(TimerEvent.TIMER, onTimer);
}
function onLoad(e:Event):void
{
addChild(ldr.content);
timer.start();
ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoad);
}
function onTimer(e:TimerEvent):void
{
removeChild(ldr.content);
ldr.unload();
timer.removeEventListener(TimerEvent.TIMER, onTimer);
}