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: How to get ApplicationFacade instance 'key' for modules subcomponent  (Read 3006 times)
99miles
Jr. Member
**
Posts: 14


View Profile WWW Email
« 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?
« Last Edit: November 02, 2009, 08:04:52 by 99miles » Logged
99miles
Jr. Member
**
Posts: 14


View Profile WWW Email
« Reply #1 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?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 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>
Logged
Pages: [1]
Print