Game Timer Download

Just playing around with an idea for a game timer and thought I’d share the results for anyone who might need something similar.

Basically, this is just an ‘odometer’ style scrolling number thing that counts down from a specified number of seconds to 0. It only allows 2 digits, meaning you can only count down from a max number of 99 seconds, but what do you want for free?

Once you have the .swc (available below) in your library and you’ve imported com.onebyonedesign.utils.timer.CountdownTimer, you’ll have access to these public methods/properties:

setTime(time) – call this first – it sets the number of seconds to count down from

setColor(color) – sets the color of the scrolling digits

start() – starts the timer

currentTime – read only property that tells what second the timer’s at. Useful, if you want to change the color at say 5 seconds or whatever.

reset() – resets the timer back to the original time set with setTime()

toggle() – will pause the timer if it’s running or re-start it, if it’s paused.

it dispatches the two events Event.CHANGE (every second) and Event.COMPLETE (when the timer’s done).