差分発生行の前後
無視リスト:
コミット日時:
2009/11/12 07:47:00 (3 年前)
コミッタ:
310design
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Timer/src/org/threetendesign/utils/Timer.as

    r3217 r3219  
    99         * ... 
    1010         * @author Yukio Sato / 310design (http://310design.org) 
    11          * @version    0.8 
     11         * @version 0.9 
    1212         */ 
    1313        public class Timer extends EventDispatcher 
     
    2626                } 
    2727                 
     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. 
    2867                public function get running():Boolean 
    2968                { 
     
    3170                } 
    3271                 
    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. 
    5273                public function start():void 
    5374                { 
    5475                        if (running) { 
    55                                 trace("タイマーはすでに実行中です。"); 
     76                                trace("The Timer is running."); 
    5677                                return; 
    5778                        } 
    5879                        var count:Number = (_repeatCount != 0) ? _repeatCount - _currentCount : uint.MAX_VALUE; 
    59                         //trace(_currentCount, _repeatCount, count); 
    6080                        if (count <= 0) { 
    61                                 trace("残りカウントが0です。"); 
     81                                trace("repeatCount is set to a total that is the same or less than currentCount."); 
    6282                                return; 
    6383                        } 
     
    6585                } 
    6686                 
     87                /// Stops the timer. 
    6788                public function stop():void 
    6889                { 
     
    7091                } 
    7192                 
     93                /// Stops the timer, if it is running, and sets the currentCount property back to 0, like the reset button of a stopwatch. 
    7294                public function reset():void 
    7395                { 
     96                        stop(); 
    7497                        _currentCount = 0; 
    75                         Tweener.removeTweens(_target); 
    7698                } 
    7799                 
     100                /// Pauses the timer. 
    78101                public function pause():void 
    79102                { 
     
    81104                } 
    82105                 
     106                /// Resumes the timer. 
    83107                public function resume():void 
    84108                {