Apr 182009
// for this example I just want to count down 30 Seconds
var remainingSeconds:int = 30;
// this is the function that the setInterval function calls
function countDownSeconds() {
// not a second off of the current number of seconds
remainingSeconds--;
// if we have run out of seconds do this
if (remainingSeconds == 0) {
trace(“DONE”);
clearInterval(myInterval);
} else {
trace(“tic”);
}
}
// this is the line that calls the specified function
// in this case “countDownSeconds” and it calls it every
// 1000 milliseconds in this case.
var myInterval = setInterval(countDownSeconds, 1000);
Sorry, the comment form is closed at this time.