开发者

Flash AS3, add pause to swf loop

开发者 https://www.devze.com 2023-04-12 16:57 出处:网络
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.

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

精彩评论

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

关注公众号