Timer Class
This is a class that mimics the timer functionality of JavaScript. There are 2 variants : Timer class let’s you specify time in seconds and TimerFrameBased lets you specify the time in frames.
How to use it :
1. Create instance of the Timer Class
2. Add listener to it
3. Call “startTimer” method of the timer class, passing the name of the function to call and amount of time to call it after .
However, you can do more with this class than to use it to call a simple function after specified amount of time.
The interface of this class has methods such as “pause”, “resume”, “stopTimer”, “reset” which are pretty self explanatory.You can also pass and object to constructor and get it returned to your function, which is usefull when you want to pass a variable that would otherwise went out of scope.
This is entire code from the example above :
import com.durej.utils.Timer;
function showTimeOut(eventObj:Object)
{
output_txt.text = timeout_txt.text+ " SEC IS OUT !";
}function startTimer():Void
{
output_txt.text = "TIMER STARTED ...";
timer.startTimer(parseInt(timeout_txt.text),"showTimeOut");
}
timer = new Timer();
timer.addEventListener("showTimeOut",this);
startButton.onRelease = mx.utils.Delegate.create(this,startTimer);

