This is about basically how to get your current system time using Timer() function using AS3.
For this you need to create four dynamic text boxes and name those as txtHrs, txtMins, txtSecs, and txtDate.
Put the following actions in your movie frame and create a class and use these.
var time:Timer = new Timer(10);
tm.addEventListener(TimerEvent.TIMER, update);
function update(tevt:TimerEvent):void {
var now:Date = new Date();
var hr:Number = now.hours;
var min:Number = now.minutes;
var sec:Number = now.seconds;
if (hr > 12) {
hr -= 12;
}
txtHrs.text = String(hr);
if (min < 10) {
txtMins.text = “0″;
}
else {
txtMins.text = “”;
}
txtMins.appendText(String(min));
if (sec < 10) {
txtSecs.text = “0″;
}
else {
txtSecs.text = “”;
}
txtSecs.appendText(String(sec));
txtDate.text = now.toDateString();
}
time.start();
Now test your movie and you can see your system time on your movie display.
Try this!.
Tags: AS3