御赐掌柜,节约用水漫画,薛璐 下载
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();
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
-
MAYA制作玻璃的三种材质教程
这篇教程是向脚本之家的朋友介绍MAYA制作玻璃的三种材质方法,教程制作出来的材质非常漂亮,难度也不是很大,推荐到脚本之家,喜欢的朋友可以参考一下... 15-1...
[阅读全文]
-
-
-
-
-
网友评论