I'm trying to call an event I've created in another component. I've added trace() into my methods so I can see what's being called. Everything except for the event listener (myEvent) is being called. Can anyone tell me why this is please?

1 Answer
1

MyComp and MyPopup aren't in the same display list hierarchy, so the bubbling event isn't being seen.

If you are wanting to send messages across components in this way consider using some sort of global event dispatcher, using using a shared model between the two components in order to see data changes.

I'm new to Flex so could you provide some sort of example of what you mean please? Are there any Frameworks out there that can do this easily?
–
ReadoSep 13 '10 at 19:04

Adding event listeners to FlexGlobals.application(I'm using 3.5 so I've forgotten the correct property name) or creating a singleton implementation of I/EventDispatcher are two less elegant ways but quick solutions for a small application.
–
jooksSep 13 '10 at 19:55

1

The Event Bus in Spring Actionscript is a good start.
–
Gregor KiddieSep 14 '10 at 7:33

Spring works spot on. Using a combination of EventBus.addEventListener() and EventBus.dispatchEvent() works great! Thanks very much! +1 :)
–
ReadoSep 14 '10 at 9:08