I wanted to interrupt Command

2009.06.18  Category:ActionScript3.0

Actually,I wanted to write that memo of the control dynamic command at Progression Frameworks.
But I had error that I cannot resolve.
This code is….

package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import jp.progression.commands.*;
import jp.progression.core.commands.Command;
import jp.progression.events.CommandEvent;
/**
* ...
* @author Shunsuke Ohba
*/
public class CancelCommand extends Sprite
{
private var _list:SerialList;
public function CancelCommand()
{
_list = new SerialList(null,
new Trace("Command1", { id:"id_Trace1" } ),
new Wait(5000,{id:"wait1"}),
new Trace("Command2", { id:"id_Trace2" } ),
new Wait(2000,{id:"wait2"}),
new Trace("Command3", { id:"id_Trace3" } )
);
stage.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void
{
if (_list.getCommandById("wait1").running) {
var command:Command = _list.getCommandById("wait1");
command.addEventListener(CommandEvent.COMMAND_COMPLETE, function(e:CommandEvent):void
{
_list.interrupt(true);
trace("interrupt Command");
});
}
});
_list.execute();
}
}
}

I wanted to interrupt the command after the WaitCommand was completed when stage was clicked at runnning “WaitCommand(id:wait1)”.Because I wanted to operate a command dynamically sometime soon.
I thought that command would interrupt when stage was clicked at runnning “WaitCommand(id:wait1)”.
Output is…

Command1
Command2
interrupt Command

Ummmm…
I cannot resolve that why do “Command2″ execute.

[postscript--June.19.2009]

I posted Progression forum.
>>post

[postscript--June.19.2009]

This probrem is resolved by flabaka.
>>post
It was resolved by using “InsertCommand” before “WaitCommand” was completed.

RSS Reader
RSSリーダーへの登録をお願いします。
トップへ戻るボタン

著者

大庭俊介
株式会社サイバーエージェント所属の紙デザイナー上がりのFlashデベロッパー。アメーバピグ内のコンテンツ企画、実装を手掛けています。金沢美術工芸大学出身。
follow twitter

おすすめ

イニシエーション・ラブ/ 乾 くるみ

最後の2行目を見たときにマジでビビり、最初からまた読み返してしまい、ネタばれのサイトに行き着く。

フィジカルコンピューティングを「仕事」にする

初めての共著作。Kinect作品PiggFighterの項目を執筆しています。

基礎からのiOS SDK

iPhone開発ド素人の僕が現在、勉強中の本。結構丁寧に書かれてあって分かりやすい。特にWebブラウザ作成のチュートリアル部分の説明でかなり理解が深まった。