【问题标题】:flash/actionscript to display an image for x secondsflash/actionscript 显示图像 x 秒
【发布时间】:2011-04-04 16:51:42
【问题描述】:

是否有任何开源 flash/actionscript 代码可以在 x 秒内显示图像。

【问题讨论】:

    标签: flash actionscript-3 actionscript


    【解决方案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);
    }
    

    【讨论】:

      猜你喜欢
      • 2011-03-31
      • 2013-11-22
      • 1970-01-01
      • 1970-01-01
      • 2016-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多