In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Timer Practice

タイマーのテストです。
Get Adobe Flash player
by nika 27 Nov 2011
    Embed
/**
 * Copyright nika ( http://wonderfl.net/user/nika )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/c71J
 */

package{
  import flash.display.*;
  import flash.text.*;
  import flash.utils.Timer;
  import flash.events.TimerEvent;
 
  public class Main extends Sprite{
    private var textField:TextField;
    private var interval:uint=1000; // millisecond
    private var repeat:uint = 5;
    private var myTimer:Timer = new Timer(interval,repeat);
 
    public function Main() {
      textField = new TextField();
      textField.x = 0;
      textField.y = 50;
      textField.text = "Hello, world!!";
      addChild(textField);
      myTimer.start();
      myTimer.addEventListener(TimerEvent.TIMER, timerHandler);
      myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler);
    }
 
    private function timerHandler(e:TimerEvent):void{
      textField.appendText("\n");
      textField.appendText("Hello!");
    }
 
    private function completeHandler(e:TimerEvent):void{
      textField.text = "owata";
    }
  }
}