当前位置:软件学习 > Flash >>

flash as 程序延迟运行方法

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();
}

补充:flash教程,As3.0
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,