| 1 |
package commands |
|---|
| 2 |
{ |
|---|
| 3 |
import flash.events.EventDispatcher; |
|---|
| 4 |
|
|---|
| 5 |
/** |
|---|
| 6 |
* ParallelCommand と SerialCommand のベースとなる抽象クラス. |
|---|
| 7 |
* |
|---|
| 8 |
* <p>このクラスが実際にインスタンス化されることはありません。</p> |
|---|
| 9 |
* |
|---|
| 10 |
* @see commands.ParallelCommand |
|---|
| 11 |
* @see commands.SerialCommamd |
|---|
| 12 |
*/ |
|---|
| 13 |
public class BatchCommand extends CommandBase |
|---|
| 14 |
{ |
|---|
| 15 |
protected var _commands:Array |
|---|
| 16 |
protected var _index:Number |
|---|
| 17 |
|
|---|
| 18 |
public function BatchCommand( commandArray:Array=null ) |
|---|
| 19 |
{ |
|---|
| 20 |
super(); |
|---|
| 21 |
|
|---|
| 22 |
_index = 0; |
|---|
| 23 |
_commands = (commandArray==null)? [] : commandArray.concat(); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
/** |
|---|
| 28 |
* ICommandインターフェースを実装したコマンドを処理に追加します。 |
|---|
| 29 |
* @param com ICommandインターフェースを実装したコマンド。 |
|---|
| 30 |
*/ |
|---|
| 31 |
public function push(com:ICommand):BatchCommand |
|---|
| 32 |
{ |
|---|
| 33 |
_commands.push(com); |
|---|
| 34 |
return this; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
/** |
|---|
| 39 |
* Commandインスタンスを作成し処理に追加するショートカット関数。 |
|---|
| 40 |
*/ |
|---|
| 41 |
public function pushCommand(thisObject:*, func:Function, params:Array=null):BatchCommand |
|---|
| 42 |
{ |
|---|
| 43 |
push(new Command(thisObject, func, params)); |
|---|
| 44 |
|
|---|
| 45 |
return this; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
/** |
|---|
| 50 |
* WaitCommandインスタンスを作成し処理に追加するショートカット関数。 |
|---|
| 51 |
*/ |
|---|
| 52 |
public function pushWait( delay:Number ):BatchCommand |
|---|
| 53 |
{ |
|---|
| 54 |
push(new WaitCommand(delay)); |
|---|
| 55 |
return this; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
/** |
|---|
| 60 |
* SerialCommandインスタンスを作成し処理に追加するショートカット関数。 |
|---|
| 61 |
*/ |
|---|
| 62 |
public function pushSerial( commands:Array = null ):BatchCommand |
|---|
| 63 |
{ |
|---|
| 64 |
push(new SerialCommand(commands)); |
|---|
| 65 |
return this; |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
/** |
|---|
| 70 |
* ParallelCommandインスタンスを作成し処理に追加するショートカット関数。 |
|---|
| 71 |
*/ |
|---|
| 72 |
public function pushParallel( commands:Array = null ):BatchCommand |
|---|
| 73 |
{ |
|---|
| 74 |
push(new ParallelCommand(commands)); |
|---|
| 75 |
return this |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
public function pushAsync(thisObject:Object, func:Function, params:Array, eventDispatcher:EventDispatcher, eventType:String):BatchCommand |
|---|
| 79 |
{ |
|---|
| 80 |
push(new AsyncCommand(thisObject, func, params, eventDispatcher, eventType)); |
|---|
| 81 |
return this; |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
/** |
|---|
| 85 |
* FrameWaitCommandインスタンスを作成し処理に追加するショートカット。 |
|---|
| 86 |
*/ |
|---|
| 87 |
public function pushFrameWait(frameNum:int):BatchCommand |
|---|
| 88 |
{ |
|---|
| 89 |
push(new FrameWaitCommand(frameNum)); |
|---|
| 90 |
return this; |
|---|
| 91 |
} |
|---|
| 92 |
} |
|---|
| 93 |
} |
|---|