开发者

Flash AS3, add pause to swf loop

I don't work in Flash very often, all I need is to add the AS to make my swf pause for a few seconds before looping.

This used to work in AS2:

 stop();
 var interval:Number = setInterval(
   function():Void {
     play();
     clearInterval(interval);
   },
开发者_运维知识库   2000
 );

Any help is appreciated, thanks!


Make sure you import the utility.

import flash.utils.setInterval;

But rather than using setInterval use setTimeout

import flash.utils.setTimeout;
stop();
setTimeout(
  function():Void {
    play();
  },
  2000
);

To do this the more AS3-esque way, use the Timer class.


It seems like your current code should still work, except you need to lowercase your "void"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜