Re: [flexcoders] Re: Looking for examples of command chaining in Parsley 2.4
I'm using Parsley 2.4 and following the 2.4 documentation the [CommandXXX] metatags (aysnchronous command methods section 6.9) are no longer recommended. I've be using DynamicObjects (short-lived command objects section 6.10) and none of ArtInFlex's examples use the asynchronous command methods. And since I'm new to Parsley, I'll be following all recommendations where possible. Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney Topic: Deploying Coldfusion into the Cloud Date: 26th September 6pm for 6:30 start Details and RSVP on http://apugs.groups.adobe.com/index.cfm?event=post.displaypostid=38239
RE: [flexcoders] Re: Looking for examples of command chaining in Parsley 2.4
If you are using short-lived command objects, just dispatch an event from the result function of the command class to trigger the execution of the next command in the chain.Can you provide a simple use case showing what you are trying to achieve and how you are doing it? Regards,Yang To: flexcoders@yahoogroups.com From: chris.velevi...@gmail.com Date: Tue, 6 Sep 2011 09:17:34 +1000 Subject: Re: [flexcoders] Re: Looking for examples of command chaining in Parsley 2.4 I'm using Parsley 2.4 and following the 2.4 documentation the [CommandXXX] metatags (aysnchronous command methods section 6.9) are no longer recommended. I've be using DynamicObjects (short-lived command objects section 6.10) and none of ArtInFlex's examples use the asynchronous command methods. And since I'm new to Parsley, I'll be following all recommendations where possible. Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney Topic: Deploying Coldfusion into the Cloud Date: 26th September 6pm for 6:30 start Details and RSVP on http://apugs.groups.adobe.com/index.cfm?event=post.displaypostid=38239 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: Looking for examples of command chaining in Parsley 2.4
I've tried both creating commands in the result handler and by using the Task framework. I like the Task framework because it's more modular in that it helps keep the commands independent. Having said that, I'm having problems getting it working. I created a task per command and each task dispatches the message for the command and wait for the results. Then I've created a sequential task group and added each task and then start the group. Here is an example of one of my tasks:- package mytasks { import org.spicefactory.lib.task.Task; import org.spicefactory.parsley.asconfig.ActionScriptContextBuilder; import MyMessage; import MyModel; public class MyTask extends Task { [Inject(id=myModel)] [Bindable] public var myModel:MyModel; [MessageDispatcher] public var messageDispatcher:Function; public function MyTask() { super(); ActionScriptContextBuilder.build(MyConfig); } protected override function doStart():void { messageDispatcher(new MyMessage()); } [MessageHandler] public function handleMyMessage(message:MyMessage):void { if (message.success == true) { myModel.debug = success; complete(); } else { error(my task failed); } } } } And my configuration file contains:- model:MyModel id=myModel/ spicefactory:DynamicCommand type={MyCommand} selector=execute result=handleResult error=handleError/ My command is:- package mycommands { import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.rpc.AsyncToken; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.remoting.RemoteObject; import MyMessage; import MyModel; public class MyCommand { [Inject(id=ro)] public var service:RemoteObject; [Inject(id=myModel)] public var myModel:MyModel; public function execute (message:MyMessage) : AsyncToken { return service.getRemoteData(myModel.id); } public function handleResult(result:ResultEvent, message:MyMessage):void { if (result.result != null) { myModel.dataCollection = result.result as ArrayCollection; message.success = true; } } public function handleError(fault:FaultEvent, trigger:MyMessage):void { Alert.show(fault.toString()); } } } But when I run this I get value is not a function. So what have I missed or left out? Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney Topic: Deploying Coldfusion into the Cloud Date: 26th September 6pm for 6:30 start Details and RSVP on http://apugs.groups.adobe.com/index.cfm?event=post.displaypostid=38239