国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 辦公 > Flash > 正文

AS3 程序延遲執行的方法分享

2020-07-17 13:15:08
字體:
來源:轉載
供稿:網友

復制代碼
代碼如下:

import flash.events.TimerEvent;
import flash.utils.Timer;

/**
* delay function
* a quick and easy delay function that can call a function with parameters. configurable
* with delay time and repeat frequency
*
* @param func:Function The function to call when timer is complete
* @param params:Array An array of parameters to pass to the function
* @param delay:int [OPTIONAL] The number of milliseconds to wait before running the function
* @param repeat:int [OPTIONAL] The number of times the function should repeat
*/
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();
}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郓城县| 治县。| 安宁市| 汪清县| 龙里县| 五寨县| 宁河县| 宣汉县| 广河县| 稷山县| 济南市| 中方县| 滨州市| 安庆市| 通州区| 五原县| 楚雄市| 罗山县| 鹤壁市| 盱眙县| 都匀市| 疏附县| 宜城市| 龙州县| 浦北县| 永靖县| 辽中县| 长垣县| 江山市| 湛江市| 南召县| 岳阳县| 屏山县| 东阿县| 嘉义市| 襄城县| 永定县| 红河县| 连平县| 吉隆县| 玉溪市|