Listening for events from child components of View in Mediator

Kyle's Avatar

Kyle

25 Jun, 2013 07:57 PM

I am trying to listen for events in my Mediator from a child component in my view, but the events are not bubbling up. To try and provide an example:

Actors:
MyWindowMediator
MyWindowView
MyButton

Inside of MyWindowMediator I have a listener setup as such:
addEventListener( ButtonEvent.BUTTON_CLICKED , onButtonClicked);

Inside of MyWindowView I have an instance of MyButton. When MyButton is clicked it dispatches an event with bubbles set to true. *Note that MyButton.as is actually handling the dispatching of the event.*

var ButtonEvent = new ButtonEvent( ButtonEvent.BUTTON_CLICKED, true );

This event IS received by MyWindowView (the parent of MyButton); however, it is never received my MyWindowMediator. I can't seem to figure out why this event wouldn't bubble up to the parent Mediator (I'm assuming this is a simple function of how the framework handles events and the relationship between the view and mediator, but am hoping someone can point me in the right direction).

Thanks!

-Kyle

  1. 1 Posted by Kyle on 25 Jun, 2013 09:00 PM

    Kyle's Avatar

    As I suspected, there is a VERY simple solution to this one: I simply had to remove my head from my own ass and remind myself that Mediators are pretty much useless unless you remember to MAP THEM!

    Newbs take note: If something is going wierd with your Mediator, double-check that you actually mapped it to your view! =]

    I'm gonna go ahead and close this one and quietly walk away hoping no one notices haha...

  2. Kyle closed this discussion on 25 Jun, 2013 09:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac