flash player_flash as 程序延迟运行方法

更新时间:2017-01-24    来源:组件控件开发    手机版     字体:

【www.bbyears.com--组件控件开发】

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

本文来源:http://www.bbyears.com/asp/29991.html

猜你感兴趣