我正在使用Flash pfofessional CC开发iOS和android系统,并使用air sdk 15开发应用程序。是他们停止代码执行的任何方式,是他们这样做的任何功能,例如
pause(for_seconds);
There is not a sleep function, but you can delay the call of a function:
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(); // <----
}
You can try with this too:
var timeToWait:int=100;
startTime = getTimer();
while(getTimer() - startTime < timeToWait){}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.