- 2008-11-26 (水) 0:04
- ActionScript3.0 | Progression
ParallelListとSerialListを定義する方法は、いろいろあるかと思うので、ちょっとまとめてみました。
- new SerialListと記述する方法
- new ParallelListと記述する方法
- addCommand内にずらずら記述していく方法
- addCommand内に[]を記述する方法
- new SerialListに配列を指定する方法
- new ParallelListに配列を指定する方法
- 配列をSerialListにする方法
- 配列をParallelListにする方法
1.new SerialListと記述する方法
これはリファレンスのSerialListクラスのExampleに掲載されている方法です。
var list:SerialList = new SerialList();
list.addCommand(
new Trace("あ"),
new Wait( 1000 ),
new Trace("い"),
new Wait( 1000 ),
new Trace("う"),
new Wait( 1000 ),
new Trace("え"),
new Wait( 1000 ),
new Trace("お")
);
list.execute();
これを実行すると、あいうえおが1秒ごとに出力パネルに表示されます。
SerialListはその名前の通り、頭から順番に処理を実行していくということになります。
では次に、同じソースをParallelListで実行してみることにします。
2.new ParallelListと記述する方法
var list:ParallelList = new ParallelList();
list.addCommand(
new Trace("あ"),
new Wait( 1000 ),
new Trace("い"),
new Wait( 1000 ),
new Trace("う"),
new Wait( 1000 ),
new Trace("え"),
new Wait( 1000 ),
new Trace("お")
);
list.execute();
これを実行すると、あいうえおが同時に出力パネルに表示されます。
つまり、コマンド内に記述された処理が、全て同時に行われるということです。
3.addCommand内にずらずら記述していく方法
new SerialListをしなくても、addCommand内に処理をズラズラ書いていけば、SerialListとして認識されるっぽいです。
以下のコードで試してみたいと思います。
addCommand(
new Trace("あ"),
new Wait( 1000 ),
new Trace("い"),
new Wait( 1000 ),
new Trace("う"),
new Wait( 1000 ),
new Trace("え"),
new Wait( 1000 ),
new Trace("お")
);
これを実行すると、1の場合と同様に、あいうえおと1秒ごとに出力パネルに表示されていきます。
4.addCommand内に[]を記述する方法
コードを[]で囲むだけでParallelListとして認識される様になります。
addCommand(
[
new Trace("あ"),
new Wait( 1000 ),
new Trace("い"),
new Wait( 1000 ),
new Trace("う"),
new Wait( 1000 ),
new Trace("え"),
new Wait( 1000 ),
new Trace("お")
]
);
これを実行すると、2と同様にあいうえおが同時に出力パネルに表示されます。
5.new SerialListに配列を指定する方法
var list:SerialList = new SerialList();
list.addCommand(
[
new DoTransition(this , Iris , Transition.IN, 2, Strong.easeOut,{startPoint:5, shape:Iris.CIRCLE}),
new DoTransition(this , Squeeze , Transition.IN, 2, Elastic.easeOut,{dimension:1})
]
);
list.execute();
この様に指定すると、SerialListではなくParallelListとして処理されます。
6.new ParallelListに配列を指定する方法
var list:ParallelList = new ParallelList();
list.addCommand(
[
new DoTransition(this , Iris , Transition.IN, 2, Strong.easeOut,{startPoint:5, shape:Iris.CIRCLE}),
new DoTransition(this , Squeeze , Transition.IN, 2, Elastic.easeOut,{dimension:1})
]
);
list.execute();
この様に指定すると、ParallelListではなくSerialListとして処理されます。
配列を処理する場合、5.6のパターンだとちょっと分かりにくいかと思います。
なので、new ○○○○しないで、3.4のようにaddCommand内にずらずら記述していくパターンがいいのではないかと(個人的に)思います。
7.配列をSerialListにする方法
addCommand(
new DoTransition(this , Iris , Transition.IN, 2, Strong.easeOut,{startPoint:5, shape:Iris.CIRCLE}),
new DoTransition(this , Squeeze , Transition.IN, 2, Elastic.easeOut,{dimension:1})
);
8.配列をParallelListにする方法
addCommand(
[
new DoTransition(this , Iris , Transition.IN, 2, Strong.easeOut,{startPoint:5, shape:Iris.CIRCLE}),
new DoTransition(this , Squeeze , Transition.IN, 2, Elastic.easeOut,{dimension:1})
]
);
- Newer: Command処理内でtraceしたい!
- Older: 『第一回ラーメンサラダを広める会』開催します!
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://flabaka.com/blog/wp-trackback.php?p=329
- Listed below are links to weblogs that reference
- ParallelListとSerialList from flabaka