[英]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.