All pastes #798986 Raw Edit

Untitled

public text v1 · immutable
#798986 ·published 2007-11-27 05:08 UTC
rendered paste body
setInterval() and clearInterval() are much more elegant than this method. set interval is independent of the timeline and is actually based on time rather than the framerate. 
ie...
//first we set a variable that will be the max number of seconds to wait before the timer is does it's thing

var maxNum:Number = 10;
function myDelay(){
//i will be the counter. When i is equal to or greater than 10 your actions will execute.

i=-1;
if(++i=>maxNum){
//clear the startTimer to stop the loop
clearInterval(startTimer)
//run your actions.
}
}

//start timer will run once every second (1000) 
startTimer = setInterval(this,"myDelay()",1000)