views:

52

answers:

2

I have a flex app under construction that makes use of a lot of . I have a main module that has child modules. Ugh, I know. in one of these sub-modules, i want to know if i click a button. The handler for that button-click resides "higher" up in the app. I added an eventlistener looking for the event that I dispatch down in the sub-module, but no-go. Am I doing something wrong or is there a scope problem or something?

I know this is kinda vague, but I don't really know how to even debug this one, frankly.

Thanks in advance and be gentle. :)

+1  A: 

Where do you add the event listener? If you add it not directly to the object that dispatches the event but further up then you need to make sure your event bubbles. Try

dispatchEvent(new Event(YOUR_EVENT_ID), true)

And check this page on event propagation.

Stefan
It should also be noted that bubbling of events only work with objects on the display chain. If you have objects that are event dispatchers but not part of the display chain, setting bubbles to true will have no effect.
macke
A: 

Are you declaring the events that child dispatches? i.e.

[Event(name="eventName", type="eventType")]

Ryan K