The command classes already exists and work in their own right for their
respective views. I will not always want to update both the views at the
same time.
You seem to be getting confused with the purpose of the event. The event is
broadcast once the product has been added, not when the product is required
to be added. I then want to be able to specify in my front controller:
addCommand("productAdded", new CommandToUpdateViewOne());
-----Original Message-----
From: Alex [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 04 February 2005 12:47
To: [email protected]
Subject: RE: [flexcoders] Cairngorm Event to Command
Not sure why it requires to create a new command class.
onResult function in your command class that is assigned with "add product"
event would be something like
public function onResult( event : Object ) : Void
{
var view1ViewHelper =
ViewLocator.getInstance().getViewHelper( "view1" );
var view2ViewHelper =
ViewLocator.getInstance().getViewHelper( "view2" );
view1ViewHelper.doSomethingInView1();
view2ViewHelper.doSomethingInView2();
}
Alex.
-----Original Message-----
From: Michael Herron [mailto:[EMAIL PROTECTED]
Sent: Friday, February 04, 2005 3:39 PM
To: [email protected]
Subject: RE: [flexcoders] Cairngorm Event to Command
Yes that would certainly work, but that would involve creating a new command
class. I was wanting to re-use the command classes that are currently being
used, but just fire them both for the same event.
Although your solution does seem more elegant that broadcasting multiple
events.
-Mike
-----Original Message-----
From: Alex [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 04 February 2005 12:11
To: [email protected]
Subject: FW: [flexcoders] Cairngorm Event to Command
Hi Mike,
I presume nothing prevents you from accessing two different views via
ViewLocator singleton within one command.
Regards,
Alex.
-----Original Message-----
From: Michael Herron [mailto:[EMAIL PROTECTED]
Sent: Friday, February 04, 2005 2:48 PM
To: [email protected]
Subject: [flexcoders] Cairngorm Event to Command
Hi all
Just a quick question about using cairngorm:
In my application when a product has been added, I wish to broadcast a
"product added" event and have it picked up by two separate command classes
that will update two separate views. Unfortunately, when the event is
broadcast, it only seems to be picked up by the command class that was
registered last in the controller.
To get round this I am having to broadcast two separate events specific to
the two views once a product has been added. Obviously, this doesn't provide
as high a level of de-coupling as I would like.
Has anyone else come across this problem? Am I doing something wrong or is
this a know "quirk"?
Cheers,
Mike
Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links