var myTimer:Timer = new Timer(500);
myTimer.addEventListener(TimerEvent.TIMER,tick);
myTimer.start();
updateTime();
 
function tick(event:TimerEvent):void {
        updateTime();
}
 
function updateTime():void{
        var date = new Date();
        var secs:uint = date.getSeconds();
        var mins:uint = date.getMinutes();
        var hours:uint = date.getHours();
        timetext.text = pad(hours) + " : " + pad(mins) + " : " + pad(secs);
}
 
function pad(number:Number){
        //Turn our number in to a string
        var new_num:String = String(number);
        //Needs padding out?
        if(new_num.length < 2){
                //Add a zero
                new_num = "0" + new_num;
        }
        //Return new, better value as a string
        return new_num;
}