flash on 2009-11-2
timerの0(ずっと実行)の動きでもコンプリートをなんとか受け取りたい、、
♥0 |
Line 41 |
Modified 2009-11-19 11:09:12 |
MIT License
archived:2017-03-20 04:54:44
ActionScript3 source code
/**
* Copyright h1ro ( http://wonderfl.net/user/h1ro )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/u2bg
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.utils.*;
import flash.events.*;
//timerの0(ずっと実行)の動きでもコンプリートをなんとか受け取りたい、、
public class TimerTest extends Sprite {
private var sprite:Sprite;
private var text_field:TextField;
private var text_field2:TextField;
private var timer:Timer;
private var timer2:Timer;
public function TimerTest(){
init();
initTimer();
}
private function init():void{
//traceの代わり
//親のタイマー用
text_field = new TextField();
text_field.width = stage.stageWidth;
addChild(text_field);
text_field.y = 0;
text_field.text = "始まり";
//子のタイマー用
text_field2 = new TextField();
text_field2.width = stage.stageWidth;
addChild(text_field2);
text_field2.y = text_field.height;
text_field2.text = "始まり";
}
private function initTimer():void{
timer = new Timer(3000, 0);
timer.addEventListener(TimerEvent.TIMER,progressFunc);
timer.addEventListener(TimerEvent.TIMER_COMPLETE,completeFunc);
timer.start();
}
private function progressFunc(te:TimerEvent):void{
text_field.text = "実行中";
}
private function completeFunc(te:TimerEvent):void{
text_field.text = "終了しました";
}
}
}