Friday, December 18, 2009

The TimeLabel component

The time label component is something I slapped together to show accumulated time. Its an enhanced ActionScript3 Label with a simple API for making it tick.

Input a numeric value of time in milliseconds, and the TimeLabel will display it grouped nicely in days, hours minutes and seconds.

Invoke the time label’s start/stop to make it count seconds in any direction you like.

Untitled-1

This is the image of the TimeLabel, I surrounded with the controls that operate its API.

The API is as following:

Set and retrieve the numeric value representing time in milliseconds (note; there is no numeric validation, so its up to you):

  • function set data(value:Object):void
  • function get data():Object

Start and stop the timer:

  • function start():void
  • function stop():void

Determine if the timer goes up or down:

  • function increment():void
  • function decrement():void

download source code