一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

flash as 程序延迟运行方法

时间:2022-06-28 22:17:41 编辑:袖梨 来源:一聚教程网

flash as 程序延迟运行方法

private function delay(func:function, params:array, delay:int = 350, repeat:int = 1):void
{
var f:function;
var timer:timer = new timer(delay, repeat);
timer.addeventlistener(timerevent.timer, f = function():void
{
func.apply(null, params);
if (timer.currentcount == repeat)
{
timer.removeeventlistener(timerevent.timer, f);
timer = null;
}
});
timer.start();
}

热门栏目