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: Passing multiple values to a command  (Read 8919 times)
i_am_cam
Newbie
*
Posts: 4


View Profile Email
« on: January 23, 2009, 08:35:43 »

I have a command, FullScreenCommand, which requires two key elements in order to function; an event which has fired (I need to check it's type) and a reference to the application itself (so I can change the displayState of the stage).

I'm passing the event via the notification body, the reference to the application I'm obtaining within the command as follows;

:
var applicationMediator:ApplicationMediator = facade.retrieveMediator(ApplicationMediator.NAME) as ApplicationMediator;
var app:MyApp = applicationMediator.getViewComponent() as MyApp;

Does this fit with the PureMVC principles, or should I be passing both the event and app instance via the body of a custom notification?

Thanks :)
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: January 23, 2009, 12:15:23 »

There's nothing wrong with a command accessing a mediators public properties. You just don't want proxies accessing mediators.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: January 25, 2009, 07:44:52 »

Really what you want to do is send a notification from the command that the Application or Stage Mediator is interested in. That mediator should be the only object in the system interacting with the app or the stage. That's the point of having a mediator.

-=Cliff>
Logged
i_am_cam
Newbie
*
Posts: 4


View Profile Email
« Reply #3 on: January 26, 2009, 03:40:03 »

Thanks for the reply Cliff, that makes a lot of sense.
Logged
Pages: [1]
Print