我制作了这个类,并将它放在同一个 Timeline.as 包中(文档类):
package {
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Counter2 extends Timer {
public function Counter2(delay:Number, repeatCount:int=0) {
super(delay, repeatCount);
super.addEventListener(TimerEvent.TIMER, timerHandler);
}
public override function start():void {
super.start();
}
public override function stop():void {
super.stop();
}
public function timerHandler(evt:TimerEvent) {
trace(evt.target.currentCount);
}
}
}
此类在 Timeline.as 构造函数中实例化。有没有办法从这个类中引用 Timeline(root) ?如果是这样,怎么做?
谢谢!