Hello friends, what is the setTimeout function in Flex 4?
I tried the old methods like setTimeout () or setInterval but not working, not found any web references as well, anyone know? Thank you all
Hello friends, what is the setTimeout function in Flex 4?
I tried the old methods like setTimeout () or setInterval but not working, not found any web references as well, anyone know? Thank you all
Use flash.utils.Timer class for setTimeout
, setInterval
etc.
//first parameter is delay in milliseconds,
//second one is number of repetitions required -
//use zero for infinite repetition
var timer:Timer = new Timer(100, 4);
timer.addEventListener(TimerEvent.TIMER, onTimerTick);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerDone);
function onTimerTick(e:TimerEvent):void
{
var timer:Timer = Timer(e.target);
trace(timer.delay * timer.currentCount + " milliseconds passed");
}
function onTimerDone(e:TimerEvent):void
{
trace("Timer complete");
}