PureMVC Architects Lounge

PureMVC Manifold => Demos and Utils => Topic started by: byfendy on November 20, 2009, 01:41:49



Title: How to use AsyncMacroCommand
Post by: byfendy on November 20, 2009, 01:41:49
I added e few subclass to my AsyncMacroCommand.

addSubCommand(FirstAsyncCommand)
addSubCommand(SecondAsyncCommand)

each one is AsyncCommand , and each one is register a proxy. The problem is how can i notify to the MacroCommand for execute next command when the proxy has finished. Or should i use AsyncMacroCommand an another method.


Title: Re: How to use AsyncMacroCommand
Post by: puremvc on November 20, 2009, 07:33:12
Call the commandComplete () in your AsyncCommand when it is done. This will cause the AsyncMacroCommand it is a part of to execute its next subCommand.

-=Cliff>


Title: Re: How to use AsyncMacroCommand
Post by: byfendy on November 20, 2009, 03:14:25
yess i know commandComplete() and it works. But iwant to call the commandComplete () when the proxy has finished (loading xml for example) registered with the comand. Proxy will complete loading xml and then notify to macroCommand or call the commandComplete() which asyncCommand was executed.


Title: Re: How to use AsyncMacroCommand
Post by: puremvc on November 20, 2009, 04:30:30
This is why I don't advocate use of the AsyncCommand utility in these forums. It seemed as if it would be a good idea but the demo uses timers. Although it's asynchronous, it doesn't represent this scenario well, when a proxy becomes involved. You have to pass it a reference to the AsyncCommand's onComplete function, because the running command can't subscribe to notifications

I personally use the StateMachine Utility1 to split my application's runtime into discrete States. This is a great way to handle async activity.

-=Cliff>

1StateMachine Overview: http://puremvc.tv/#P003