Date and Time

By displaying the time every frame we can make a clock.

On the stage draw a clock with a dynamic text box called lblTime. Make the font big and use a font that looks like a clock. You can also add a filter such as glow or drop shadow to make it look more realistic.
Write the code as show below:
Get Adobe Flash playerIn the movie above the time is displayed in a label lblTime:
this.addEventListener(Event.ENTER_FRAME,showTime);
function showTime(e:Event):void {
	var d:Date=new Date();
	if (d.minutes < 10) lblTime.text = d.hours + ":0" + d.minutes;
	else lblTime.text = d.hours + ":" + d.minutes;
}//showTime

Download the movie
You could also do this using a timer.

NEXT: An Analog Clock (with hands)