【问题标题】:AS3 Adobe Air stop execution of codeAS3 Adobe Air 停止执行代码
【发布时间】:2014-11-14 06:06:39
【问题描述】:
我正在使用 air sdk 15 为 iOS 和 android 使用 flash pfoessional CC 开发应用程序。
他们是否有任何方法来停止代码的执行,是否有任何功能可以做到这一点,
喜欢
pause(for_seconds);
【问题讨论】:
标签:
android
ios
actionscript-3
air
adobe
【解决方案1】:
没有sleep函数,但是可以延迟函数的调用:
function delayedFunctionCall(delay:int) {
trace('going to execute the function you passed me in', delay, 'milliseconds');
var timer:Timer = new Timer(delay, 1);
timer.addEventListener(TimerEvent.TIMER, launch);
timer.start();
}
function launch(e:TimerEvent):void{
timer.removeEventListener(TimerEvent.TIMER, launch);
yourFunction(); // <----
}
你也可以试试这个:
var timeToWait:int=100;
startTime = getTimer();
while(getTimer() - startTime < timeToWait){}