Flash 中setTimeout的用法

2024-12-16 03:44:30
推荐回答(1个)
回答1:

自己按F1看flash 自带的帮助,里面就有一个例子

var my_timedProcess:Number = setTimeout(my_delayedFunction, 2000, "two second delay");

function my_delayedFunction (arg1) {
trace(arg1);
}

var escListener:Object = new Object();
escListener.onKeyDown = function() {
if (Key.isDown(Key.ESCAPE)) {
clearTimeout(my_timedProcess);
}
};
Key.addListener(escListener);