Chapter 22 Example 2
forked from Chapter 22 Example 1 (diff: 13)
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/kHFN
*/
package {
import com.actionscriptbible.Example;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class ch22ex2 extends Example {
public static const TIMER_DELAY:Number = 1 * 1000;
public var timer:Timer;
public function ch22ex2() {
timer = new Timer(TIMER_DELAY, 10);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
}
protected function onTimer(event:TimerEvent):void {
trace("Tick.");
}
protected function onTimerComplete(event:TimerEvent):void {
trace("Ding!");
}
}
}
