- コミット日時:
- 2009/11/12 07:47:00 (3 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/Timer/src/org/threetendesign/utils/Timer.as
r3217 r3219 9 9 * ... 10 10 * @author Yukio Sato / 310design (http://310design.org) 11 * @version 0.811 * @version 0.9 12 12 */ 13 13 public class Timer extends EventDispatcher … … 26 26 } 27 27 28 /// The total number of times the timer has fired since it started at zero. 29 public function get currentCount():int 30 { 31 return _currentCount; 32 } 33 34 /// The delay, in milliseconds, between timer events. 35 public function get delay():Number 36 { 37 return _delay; 38 } 39 public function set delay(value:Number):void 40 { 41 if (value < 0) { 42 throw new RangeError("Error #2006: The Timer delay specified is out of range.", 2006); 43 return; 44 } 45 _delay = value; 46 if (running) { 47 stop(); 48 start(); 49 } 50 } 51 52 /// The total number of times the timer is set to run. 53 public function get repeatCount():int 54 { 55 return _repeatCount; 56 } 57 public function set repeatCount(value:int):void 58 { 59 _repeatCount = value; 60 if (running) { 61 stop(); 62 start(); 63 } 64 } 65 66 /// The timer's current state; true if the timer is running, otherwise false. 28 67 public function get running():Boolean 29 68 { … … 31 70 } 32 71 33 public function get currentCount():int 34 { 35 return _currentCount; 36 } 37 38 public function get repeatCount():int 39 { 40 return _repeatCount; 41 } 42 43 public function set repeatCount(i:int):void 44 { 45 if (running) { 46 trace("タイマー実行中にrepeatCountの変更はできません。"); 47 return; 48 } 49 _repeatCount = i; 50 } 51 72 /// Starts the timer, if it is not already running. 52 73 public function start():void 53 74 { 54 75 if (running) { 55 trace(" タイマーはすでに実行中です。");76 trace("The Timer is running."); 56 77 return; 57 78 } 58 79 var count:Number = (_repeatCount != 0) ? _repeatCount - _currentCount : uint.MAX_VALUE; 59 //trace(_currentCount, _repeatCount, count);60 80 if (count <= 0) { 61 trace(" 残りカウントが0です。");81 trace("repeatCount is set to a total that is the same or less than currentCount."); 62 82 return; 63 83 } … … 65 85 } 66 86 87 /// Stops the timer. 67 88 public function stop():void 68 89 { … … 70 91 } 71 92 93 /// Stops the timer, if it is running, and sets the currentCount property back to 0, like the reset button of a stopwatch. 72 94 public function reset():void 73 95 { 96 stop(); 74 97 _currentCount = 0; 75 Tweener.removeTweens(_target);76 98 } 77 99 100 /// Pauses the timer. 78 101 public function pause():void 79 102 { … … 81 104 } 82 105 106 /// Resumes the timer. 83 107 public function resume():void 84 108 {

