チェンジセット 203

差分発生行の前後
無視リスト:
コミット日時:
2008/01/17 12:52:29 (4 年前)
コミッタ:
fladdict
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Commands/src/Command.as

    r47 r203  
    22{ 
    33        /** 
    4          * execute時に特定の関数を実行するコマンド 
     4         * Executes passed function, when execute() is called. 
     5         * After execution, this dispaches Event.COMPLETE. 
    56         *  
    67         * @usage 
     
    1617                protected var _params : Array; 
    1718                 
    18                 public function Command(thisObject:Object, func:Function, params:Array) 
     19                /** 
     20                 * @param thisObject:Object Scope that is used as "this" 
     21                 * @param func:Function Function will be executed 
     22                 * @param params:Array Parameters will be passed to function 
     23                 */ 
     24                public function Command(thisObject:Object, func:Function, params:Array=null) 
    1925                { 
    2026                        super(); 
     
    2632                override public function execute():void 
    2733                { 
    28                         _function.apply(_thisObject, _params); 
     34                        if(_params==null){ 
     35                                _function.apply(_thisObject); 
     36                        }else{ 
     37                                _function.apply(_thisObject, _params); 
     38                        } 
     39                         
    2940                        this.dispatchComplete(); 
    3041                } 
  • as3/Commands/src/CommandBase.as

    r200 r203  
    55         
    66        /** 
    7          * 全てのコマンドのベースクラス 
     7         * Abstract class for all commands package. 
    88         */ 
    9         public class CommandBase extends EventDispatcher 
     9        public class CommandBase extends EventDispatcher implements ICommand 
    1010        { 
    11                 //ここをオーバーライドして処理を実装する。 
     11                /** 
     12                 * Template function. 
     13                 *  
     14                 * Simply override this function with your own processing, after call dispatchComplete() function. 
     15                 */ 
    1216                public function execute():void{} 
    1317                 
    14                 //コマンドをキャンセルする。 
     18                 
     19                //cancel commands 
    1520                public function cancel():void{} 
    1621                 
    17                 //コマンド終了時のイベント発行。 
    18                 //execute以降の全ての処理が終わったら、コイツを呼び出す。 
     22                 
     23                /** 
     24                 * dispatches event after command completation. 
     25                 */ 
    1926                protected function dispatchComplete():void 
    2027                { 
    21                         dispatchEvent( new Event(Event.COMPLETE)); 
     28                        dispatchEvent( new Event(Event.COMPLETE) ); 
    2229                } 
    2330        } 
  • as3/Commands/src/ParallelCommand.as

    r47 r203  
    3030                 
    3131                 
     32                public function push(com:ICommand):void 
     33                { 
     34                        _commands.push(com); 
     35                } 
     36                 
     37                 
    3238                override public function execute():void 
    3339                { 
    3440                        for(var i:int = 0; i<_commands.length; i++) 
    3541                        { 
    36                                 var c : CommandBase = _commands[ i ]; 
     42                                var c : ICommand = _commands[ i ]; 
    3743                                c.addEventListener(Event.COMPLETE, doNextCompleteHandler); 
    3844                                c.execute(); 
     
    4349                protected function doNextCompleteHandler( e:Event ):void 
    4450                { 
    45                         var c : CommandBase = e.target as CommandBase
     51                        var c : ICommand = ICommand(e.target)
    4652                        c.removeEventListener(Event.COMPLETE, doNextCompleteHandler); 
    4753                        _index ++; 
  • as3/Commands/src/SerialCommand.as

    r200 r203  
    3030                } 
    3131                 
    32                 public function push(com:CommandBase):void 
     32                public function push(com:ICommand):void 
    3333                { 
    3434                        _commands.push(com); 
     
    4444                protected function doNext():void 
    4545                { 
    46                         var c : CommandBase = _commands[ _index ]; 
     46                        var c :ICommand = _commands[ _index ]; 
    4747                        c.addEventListener(Event.COMPLETE, doNextCompleteHandler); 
    4848                        c.execute(); 
     
    5252                protected function doNextCompleteHandler( e:Event ):void 
    5353                { 
    54                         var c : CommandBase = e.target as CommandBase
     54                        var c :ICommand = ICommand(e.target)
    5555                        c.removeEventListener(Event.COMPLETE, doNextCompleteHandler); 
    5656                         
  • as3/Commands/src/WaitCommand.as

    r47 r203  
    55         
    66        /** 
    7          * 一定時間待つコマンド。SerialCommand等で待ちを入れたいときに使う。 
     7         * Dispatches Event.COMPLETE event after certain delay. 
     8         * Used for taking a break between multiple commands. 
    89         *  
    910         * @usage 
    10          *  
    11          * var wc : WaitCommand = new WaitCommand(1000); 
    12          * wc.execute(); 
    13          *  
     11         * var command : WaitCommand = new WaitCommand(1000); 
     12         * command.execute(); 
    1413         */ 
    1514        public class WaitCommand extends CommandBase 
     
    1817                protected var _delay:Number 
    1918                 
     19                /** 
     20                 * dispatches Event.COMPLETE event after certain delay. 
     21                 * @param millisecond duration for delay 
     22                 */ 
    2023                public function WaitCommand( delay:Number = 1000) 
    2124                { 
     
    3639                { 
    3740                        _timer.removeEventListener(TimerEvent.TIMER_COMPLETE, executeCompleteHandler ); 
     41                        _timer = null; 
    3842                        dispatchComplete(); 
    3943                }