我正在使用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){}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句