Creating a countdown timer in ActionScript is quite easy. The essentials of it are:
- Specify a target date to countdown to using the Date class.
- Create a Timer instance to check the countdown time each second or so.
- At each tick of the timer calculate the number of milliseconds between now and the target date.
- Determine how many days, hours, minutes, seconds, etc. that number of milliseconds is equal to.
- Update the graphics to reflect the amount of time left.
The following is an example of a countdown timer, with a link to the source code below. This utilizes a reusable class file for the countdown timer. All code specific to this particular implementation can be found in com/anselmbradford/Main.as.