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]
Author Topic: Handling non-pureMVC-ized subcomponents  (Read 4351 times)
Courseware Beta
Sr. Member
Posts: 55

View Profile Email
« on: June 11, 2008, 04:49:48 »

I have an MXML view component implementing a menu where 'upstream functions' like startup and dataprovider population are standard pureMVC operations. The buttons used by this menu are created by a reasonably complex 3rd party .as class that knows nothing of pureMVC. My menu (the pureMVC view component) is correctly injecting the dataProvider and another property required by the button class (labelField) when it declares the button object:

<mx:Canvas id="contentCanvas" top="10" width="200">
<nav:UFMButtonList id="nav" y="200"
width="200" maxHeight="800"
labelField="@ModuleName" visible="true"
showEffect="{myWD}" hideEffect="{myWU}"

So far, so good. Now I need to modify the button component so that click  events (but only _some click events) are bubbled up to the menu component or even the the menu's mediator without incurring the complexity of making the button component a full-fledged pureMVC-ized class. I want to change just enough button code so that, at a given condition internal to the button object, the click event is passed back to the menu component or perhaps, the menu's mediator.

In other words, add a property to the button's declaration that tells the button's internal click hander where to send events that meet my conditions. To my eye, this is the same pattern as sending a 'responder' argument from a proxy to the constructor of a delegate letting the delegate know who gets the results of an asynch operation.


Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 on: June 11, 2008, 07:35:21 »

There's no need for any view component to be a 'full-fledged PureMVC class'. Its nice if you internally encapsulate things so the mediator doesn't have to know much about the view component, but that's about it. You can pretty much do what you want inside the black box.

Sr. Member
Posts: 139

View Profile Email
« Reply #2 on: June 11, 2008, 08:52:27 »

Your button component can dispatch an event that can bubble up through the component hierarchy.  In the menu mediator, you can add an event listener to your menu component, the event listener being in the mediator as usual.  The menu component will see the event, provided the button component is below it in the hierarchy.  Does this help?  Have I misunderstood?

Pages: [1]