【问题标题】:AS3 Adobe Air stop execution of codeAS3 Adob​​e Air 停止执行代码
【发布时间】:2014-11-14 06:06:39
【问题描述】:

我正在使用 air sdk 15 为 iOS 和 android 使用 flash pfoessional CC 开发应用程序。 他们是否有任何方法来停止代码的执行,是否有任何功能可以做到这一点, 喜欢

pause(for_seconds);

【问题讨论】:

  • Read the Documentation 使用Timer 类,或使用setTimeout 函数(不推荐)。
  • 没有办法停止代码执行,没有。

标签: android ios actionscript-3 air adobe


【解决方案1】:

没有sleep函数,但是可以延迟函数的调用:

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){}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-13
    • 1970-01-01
    • 2010-10-26
    • 1970-01-01
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    相关资源
    最近更新 更多