Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: How to use AsyncMacroCommand  (Read 8380 times)
byfendy
Newbie
*
Posts: 2


View Profile Email
« 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.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
byfendy
Newbie
*
Posts: 2


View Profile Email
« Reply #2 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.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 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
Logged
Pages: [1]
Print