Chapter 22 Example 3

by actionscriptbible forked from Chapter 22 Example 2 (diff: 3)
♥0 | Line 21 | Modified 2009-07-02 04:12:31 | MIT License
play

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/3AYI
 */

package {
  import com.actionscriptbible.Example;
  import flash.utils.Timer;
  import flash.events.TimerEvent;
  
  public class ch22ex3 extends Example {
    public static const TIMER_DELAY:Number = 1 * 1000;
    public var timer:Timer;
    
    public function ch22ex3() {
      timer = new Timer(TIMER_DELAY, 10);
      timer.addEventListener(TimerEvent.TIMER, onTimer);
      timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
      timer.start();
    }
    
    protected function onTimer(event:TimerEvent):void {
      trace("Tick.");
    }    

    protected function onTimerComplete(event:TimerEvent):void {
      trace("Ding!");
    }
  }
}

Forked