繁体   English   中英

AS3 Adob​​e Air停止执行代码

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM