2014-01-08 52 views
0

我需要在我的代碼中暫停代碼執行的方法(繼續當前幀動畫),並在4秒後繼續它 我不想使用atimer.addEventListener(TimerEvent .TIMER_COMPLETE,anotherMethod);因爲我已經在一個方法中,它會以另一種方法發送給我,我只想暫停執行4秒鐘......我該怎麼做?AS3暫停代碼執行等待一個計時器事件

+0

您不會停止代碼的執行,您只需設置一個計時器/超時即可在時間已過時調用方法。 – mihai

回答

2
function yourFunction():void { 

    //code you are executing before 

    setTimeout(function() { 
     //code you want to execute in 4 seconds 
     }, 4000); 
}