class Timer extends MovieClip { private var num:Number; private var thisGuy:MovieClip; private var timeInterval:Number; public var lastNum:Number=0; public var thisNum:Number; function init() { _x = 10+(Stage.width-20)*num/6; _y = 25; // attach TimeMan movieclip inside container movieclip thisGuy = attachMovie("guy", "guy1", 1); // getting data per fram by useing onEnterFrame onEnterFrame = getTime; // The fact is setInterval is worse than scanning data per frame // So I command out setInterval below //timeInterval = setInterval(this, "getTime", 1000); } function getTime() { var myDate:Date = new Date(); var hours=myDate.getHours(); var mins=myDate.getMinutes(); var secs=myDate.getSeconds(); var hour2=hours%10; var hour1=Math.floor(hours/10); var min2=mins%10; var min1=Math.floor(mins/10); var sec2=secs%10; var sec1=Math.floor(secs/10); switch(num){ case 0: thisNum=hour1; break; case 1: thisNum=hour2; break; case 2: thisNum=min1; break; case 3: thisNum=min2; break; case 4: thisNum=sec1; break; case 5: thisNum=sec2; break; } if(lastNum != thisNum){ thisGuy.hand.gotoAndPlay(1); } trace(lastNum + ", " + thisNum); lastNum=thisNum; } }