PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: 99miles on November 02, 2009, 04:29:03



Title: How to get ApplicationFacade instance 'key' for modules subcomponent
Post by: 99miles on November 02, 2009, 04:29:03
I'm thinking I've probably just had too much coffee to think straight, but, I'm using AS3 Multicore, and:
I have a module that is loaded, but then on a button click I load a subview of that module.
On creationComplete of this subview I'm trying to send a notification to call a command, but I can't figure out the best way to get the ApplicationFacade instance 'key' I used in the main component of this module.
Make sense?


Title: Re: How to get ApplicationFacade instance 'key' for modules subcomponent
Post by: 99miles on November 02, 2009, 08:02:59
So basically I'm performing a deferred instantiation in Multicore. I came up with a solution, let me know how this sounds.

My modules' ApplicationFacade defines a custom event string:

public static const EVENT_INITIALIZE_PANEL:String   = "eventInitializePanel";

Then MainMediator for the module listens for a button to be clicked, and when it handles that notification, it registers the new proxy and mediator in there because I have the access to the main facade. Then it sends a notification which calls a command to get the data to populate the new view component.

I was previously trying to send the notification that calls the command to populate the data of the new view from within the creationComplete handler, but I didn't have access to 'facade'.

I think this makes sense, and is an acceptable way to handle this problem, but at the same time it seems weird that sub views of the module would never reference 'facade' -- meaning that the root component/mediator would hold all these references.

Thoughts?


Title: Re: How to get ApplicationFacade instance 'key' for modules subcomponent
Post by: puremvc on November 04, 2009, 08:08:00
We keep view components portable by not giving them any knowledge of the PureMVC apparatus to which they are attached. The Mediator does this decoupling; mediating communications between the view hierarchy and the rest of the application.

A third party component would know nothing about the PureMVC framework, and so would need to be mediated, right? Your own components should be written in this same framework-agnostic way. You should have one way of adapting the view to the application that doesn't vary depending on whether you control the code or not.

-=Cliff>