Reinit_creative log Reinit_creative log rss

Reinit_creative log

about ActionScript3 and Design memo.

I wanted to interrupt Command

2009.06.18

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.

update 2010.01.02...

[関連記事]

My Icon

Flash+デザインを仕事としています。
info[at]reinit.info
>>detail

レコメンド

ActionScript3アニメーション

ActionScriptアニメーション

アニメーションに関する基礎が得られる本。
コレを読んで、ASが楽しくなった。