[英]AS3 Adobe Air stop execution of code
我正在使用Flash pfofessional CC开发iOS和android系统,并使用air sdk 15开发应用程序。是他们停止代码执行的任何方式,是他们这样做的任何功能,例如
pause(for_seconds);
没有睡眠函数,但是您可以延迟函数的调用:
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){}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.