Custom class dependencies: CountdownTimerEvent
Everyone always wants to make a count down to something. This is a class that attempts to enclose all the functionality that is usually needed to achieve this task. There a so many examples and tutorials out there for creating a count down, that I won’t bother explaining much here. I will go into a little about the details of THIS class though.
This class is simply an extended instance of the Timer class.
With one major addition to achieve the count down functionality. That is of course the date to count down to! The rest of the properties are fairly elementary when it comes to a count down. There are properties for the ‘milliSeconds’, ‘seconds’, ‘minutes’, ‘hours’, and ‘days’ that remain until the specified date provided by the ‘date’ property.
Here is an example of the CountDownTimer class in action. This example also uses my other class ClipTextField for the timer display. The timer is of course the one to note here:
[swfobj src=”https://jidd.jimisaacs.com/files/2008/08/example-CountdownTimer.swf” width=”450″ height=”300″ align=”center” required_player_version=”10.0.0″]
Also something important to note is that this class dispatches 2 custom event types:
- CountDownTimerEvent.TIMER
- CountDownTimerEvent.TIMER_COMPLETE
These events are pretty self-explanatory, but I suggest looking over the event class regardless.
Now here is the actual class that does all the count down work for you, enjoy 😉
com.jimisaacs.utils.CountDownTimer
Comment if you have any questions, or suggestions.
Leave a Reply