tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/3537-listening-for-events-from-child-components-of-view-in-mediatorRobotlegs: Discussion 2018-10-18T16:35:49Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/274882672013-06-25T19:57:24Z2013-06-25T19:57:24ZListening for events from child components of View in Mediator<div><p>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:</p>
<p>Actors:<br>
MyWindowMediator<br>
MyWindowView<br>
MyButton</p>
<p>Inside of MyWindowMediator I have a listener setup as such:<br>
addEventListener( ButtonEvent.BUTTON_CLICKED ,
onButtonClicked);</p>
<p>Inside of MyWindowView I have an instance of MyButton. When
MyButton is clicked it dispatches an event with bubbles set to
true. <em>Note that MyButton.as is actually handling the
dispatching of the event.</em></p>
<p>var ButtonEvent = new ButtonEvent( ButtonEvent.BUTTON_CLICKED,
true );</p>
<p>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).</p>
<p>Thanks!</p>
<p>-Kyle</p></div>Kyletag:robotlegs.tenderapp.com,2009-10-18:Comment/274882672013-06-25T21:00:12Z2013-06-25T21:00:12ZListening for events from child components of View in Mediator<div><p>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!</p>
<p>Newbs take note: If something is going wierd with your Mediator,
double-check that you actually mapped it to your view! =]</p>
<p>I'm gonna go ahead and close this one and quietly walk away
hoping no one notices haha...</p></div>Kyle