October 27, 2005
Custom Context Menus in Flash 8
I was reminded by some comments at Tinic's blog about the hassles of making custom context menus in Flash. If a parent movie clip and a child movie clip both have context menus set, the parent's menu is always shown, even when clicking on the child.
At least that's how it used to be....
Flash Player 8 changed this behavior to something more intuitive. The deepest child with a context menu that satisfies the hitTest gets to provide the menu.
To preserve backwards compatibility, the new behavior only applies to SWF8 content and later. To demonstrate, I whipped up an example. There is no difference between the two movies except the SWF version they are published to.
Right-click all over the movies to see what I'm talking about.
Published to SWF 7:
Published to SWF 8:
If you're really curious, download both samples here.
Posted by emalasky at October 27, 2005 04:36 PM
Comments
I also blogged about it sometimes back...
http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/000123.php
Posted by: Abdul Qabiz at November 6, 2005 11:30 AM
Ah, that's great, that was a huge annoyance previously.
Strangely, the new linux flash player exhibits exactly the same behavior on both movies (gets the correct child context menus)
Posted by: David R at October 27, 2006 08:38 PM
flash player 9 on mac also produces exactly the same results for both swfs.
Posted by: flashape at October 27, 2006 09:30 PM
I'm using Flash player 9 on XP in Firefox (the 9 debug browser plugin) and I too see exactly the same (intended) result for both swfs - I'm guessing that version 9 of the player has removed the old style way the context menus worked?
Anyway, this is handy I guess.
Posted by: Jon B at October 28, 2006 03:02 AM
Anybody now how to pass multiple parameters to the Context Menu?
Posted by: Rick at November 23, 2006 07:31 PM
It seems that some things changed again with Flash 9 (on any platform). anyone know about this?
Posted by: daniel larsen at November 28, 2006 01:16 PM
Here is the same appli, slightly modified for Cairngorm2 final, and FP9.
I included CG2 in the source, you can run it as a project on Eclipse..
Posted by: arkadas at September 19, 2007 09:11 PM
very good nice site..do you like to adana ??
Posted by: saglik at September 19, 2007 09:13 PM