Re: [Spam] RE: [Spam] RE: [flexcoders] Using Cairngorm and how to display a Popup from aCommand
Hello, thanks for your reply... The event is being dispatched from a Command but I'm using HTTP Service and AsyncToken to call a Web Service. I think my problem would be getting the function ref from the delegate to the responder Command as they are de-linked if that makes sense... Cheers, Nick 2009/12/25 Vaibhav Seth vaibhav.s...@live.com Hi, Thanks for the appreciation. Yups you have got it right. But in you statement: then I have the problem of getting that function reference over into the 2nd CairngormEvent, which isn't created and fired until the Web Service responder is called I think you are talking about dispatching an event from the command or Sequence Command type of thing. For that scenario, you can pass on that function reference to the the 2nd Cairngorm Event also. You can keep that parameter in the Event also. So that you always does not need to worry about it. And Function reference is in terms of instance of the command. If your command gets fired again before it returns you the result for the last executed method, even then you are safe. Keeping the view reference in the model have pros and cons. I will not prefer that way, simply because it breaks the encapsulation, view gets publicly exposed as the Model is a singleton class. But there is no hard and fast rule as well.. :) Thanks, Vaibhav Seth. [image: i'm] EMAILING FOR THE GREATER GOOD Join mehttp://im.live.com/Messenger/IM/Home/?source=EML_WLHM_GreaterGood -- To: flexcoders@yahoogroups.com From: n...@middleweek.co.uk Date: Tue, 22 Dec 2009 16:03:43 + Subject: Re: [Spam] RE: [flexcoders] Using Cairngorm and how to display a Popup from aCommand Nice post and thanks for replying... I understand your first solution, I think it's similar to a ChangeWatcher approach... but I'm a bit lost with the 2nd approach... In my circumstance, I have a button in my view that fires a Flash CLICK event, the view-mediator Handles it and fires a CairngormEvent, which invokes a CairngormCommand to call a Web Service to fetch some data. The data is loaded asynchronously and passed into a new CairngormEvent which then fires a CairngormCommand, this Command unpacks the data and if it's all gravy, it will update the model and the fetched data is displayed on the current View. If the data contains Fault event info then I need to show a custom PopUp component... I think, you're 2nd solution is storing a private or public function from inside the View on the CairngormEvent that is fired to reference it later... If I've got that right, then I have the problem of getting that function reference over into the 2nd CairngormEvent, which isn't created and fired until the Web Service responder is called... Which I believe is completely detached from the original CairngormEvent/ Command. I guess I could put the function ref on the model as a central repository but I could also just stick a reference to the View on the model and use that reference in the CairngormCommand and call PopUpManager.createPopup... What are your thoughts cause I'm a bit lost :) Cheers, nick 2009/12/21 Vaibhav Seth vaibhav.s...@live.com hi, Well that's a good question for the starters. Please go through my below blog. Hope you will get some thing out from there. http://groups.adobe.com/posts/ffa987b8a4 Thanks, Vaibhav Seth.
RE: [Spam] RE: [flexcoders] Using Cairngorm and how to display a Popup from aCommand
Hi, Thanks for the appreciation. Yups you have got it right. But in you statement: then I have the problem of getting that function reference over into the 2nd CairngormEvent, which isn't created and fired until the Web Service responder is called I think you are talking about dispatching an event from the command or Sequence Command type of thing. For that scenario, you can pass on that function reference to the the 2nd Cairngorm Event also. You can keep that parameter in the Event also. So that you always does not need to worry about it. And Function reference is in terms of instance of the command. If your command gets fired again before it returns you the result for the last executed method, even then you are safe. Keeping the view reference in the model have pros and cons. I will not prefer that way, simply because it breaks the encapsulation, view gets publicly exposed as the Model is a singleton class. But there is no hard and fast rule as well.. :) Thanks, Vaibhav Seth. EMAILING FOR THE GREATER GOOD Join me To: flexcoders@yahoogroups.com From: n...@middleweek.co.uk Date: Tue, 22 Dec 2009 16:03:43 + Subject: Re: [Spam] RE: [flexcoders] Using Cairngorm and how to display a Popup from aCommand Nice post and thanks for replying... I understand your first solution, I think it's similar to a ChangeWatcher approach... but I'm a bit lost with the 2nd approach... In my circumstance, I have a button in my view that fires a Flash CLICK event, the view-mediator Handles it and fires a CairngormEvent, which invokes a CairngormCommand to call a Web Service to fetch some data. The data is loaded asynchronously and passed into a new CairngormEvent which then fires a CairngormCommand, this Command unpacks the data and if it's all gravy, it will update the model and the fetched data is displayed on the current View. If the data contains Fault event info then I need to show a custom PopUp component... I think, you're 2nd solution is storing a private or public function from inside the View on the CairngormEvent that is fired to reference it later... If I've got that right, then I have the problem of getting that function reference over into the 2nd CairngormEvent, which isn't created and fired until the Web Service responder is called... Which I believe is completely detached from the original CairngormEvent/ Command. I guess I could put the function ref on the model as a central repository but I could also just stick a reference to the View on the model and use that reference in the CairngormCommand and call PopUpManager.createPopup... What are your thoughts cause I'm a bit lost :) Cheers, nick 2009/12/21 Vaibhav Seth vaibhav.s...@live.com hi, Well that's a good question for the starters. Please go through my below blog. Hope you will get some thing out from there. http://groups.adobe.com/posts/ffa987b8a4 Thanks, Vaibhav Seth.
Re: [Spam] RE: [flexcoders] Using Cairngorm and how to display a Popup from aCommand
Nice post and thanks for replying... I understand your first solution, I think it's similar to a ChangeWatcher approach... but I'm a bit lost with the 2nd approach... In my circumstance, I have a button in my view that fires a Flash CLICK event, the view-mediator Handles it and fires a CairngormEvent, which invokes a CairngormCommand to call a Web Service to fetch some data. The data is loaded asynchronously and passed into a new CairngormEvent which then fires a CairngormCommand, this Command unpacks the data and if it's all gravy, it will update the model and the fetched data is displayed on the current View. If the data contains Fault event info then I need to show a custom PopUp component... I think, you're 2nd solution is storing a private or public function from inside the View on the CairngormEvent that is fired to reference it later... If I've got that right, then I have the problem of getting that function reference over into the 2nd CairngormEvent, which isn't created and fired until the Web Service responder is called... Which I believe is completely detached from the original CairngormEvent/ Command. I guess I could put the function ref on the model as a central repository but I could also just stick a reference to the View on the model and use that reference in the CairngormCommand and call PopUpManager.createPopup... What are your thoughts cause I'm a bit lost :) Cheers, nick 2009/12/21 Vaibhav Seth vaibhav.s...@live.com hi, Well that's a good question for the starters. Please go through my below blog. Hope you will get some thing out from there. http://groups.adobe.com/posts/ffa987b8a4 Thanks, Vaibhav Seth.