我有一个 fla 文件和一个名为theAlarmClock
. 时钟上的指针应该在移动,但之后Ctrl+Enter
- 它们是空闲的。
package
{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class theAlarmClock extends MovieClip
{
var myDate:Date;
var mySec:int;
var myMin:int;
var myHou:int;
var myTimer:Timer = new Timer(1000);
public function theAlarmClock()
{
myTimer.addEventListener(TimerEvent.TIMER, updateClock);
myTimer.start();
function updateClock(t:TimerEvent):void
{
myDate = new Date();
mySec = myDate.seconds;
myMin = myDate.minutes;
myHou = myDate.hours;
clockHandSeconds_mc.rotation = mySec * 6;
clockHandMinutes_mc.rotation = myMin * 6;
clockHandHours_mc.rotation = myHou * 30 + myMin * 0.5;
trace("tick");
}
}
}
}