Timer Practice
タイマーのテストです。
/**
* 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";
}
}
}