views:

82

answers:

2

I have a Flex app with a viewport that loads a series of other swfs. I would like to place a context menu over top of the SWFs when the user right-clicks. To that end, I have set up a fairly standard context menu where each item has a ContextMenuEvent.MENU_ITEM_SELECT event handler. One problem: The eventHandler never gets called.

If I place the context-menu code anywhere else in the app, i.e. not on top of a loaded SWF, everything works fine. However, when I place the exact same code on the SWF viewport, the context menu items appear, but the eventHandlers are never called. Any ideas?

A: 

I'm not sure I understand your problem, but this is my insight. The SWF is embedded and can only be expected to change the visual appearance of your Flex app, but you cannot expect the embedded SWF to do the work of dispatching events as well. You will need to "bubble out" the events into the SWF's parent(s) and let the parent deal with the event. http://www.adobe.com/devnet/flex/articles/itemrenderers%5Fpt1.html

Let me know, thanks!

Luis B
Definitely not a bad theory, but in this case I have very little control over the SWFs themselves. It looks like what we are going to end up having to do is to add an invisible sprite over the swf to keep the context menu data inside the app. Thanks for the insight!
Palantar
A: 

i think is because the event doesn't bubble up to your app where you have the listeners.

TheBrain