by Ethan Malasky

 Comments (13)

Created

October 27, 2005

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.

COMMENTS

  • By Abdul Qabiz - 11:30 AM on November 6, 2005   Reply
  • By David R - 8:38 PM on October 27, 2006   Reply

    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)

  • By flashape - 9:30 PM on October 27, 2006   Reply

    flash player 9 on mac also produces exactly the same results for both swfs.

  • By Jon B - 3:02 AM on October 28, 2006   Reply

    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.

  • By Rick - 7:31 PM on November 23, 2006   Reply

    Anybody now how to pass multiple parameters to the Context Menu?

  • By daniel larsen - 1:16 PM on November 28, 2006   Reply

    It seems that some things changed again with Flash 9 (on any platform). anyone know about this?

  • By arkadas - 9:11 PM on September 19, 2007   Reply

    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..

  • By saglik - 9:13 PM on September 19, 2007   Reply

    very good nice site..do you like to adana ??

  • By güzel sözler - 5:19 PM on November 24, 2008   Reply

    veryy good site thanks You…

  • By motosiklet - 5:20 PM on November 24, 2008   Reply

    Anybody now how to pass multiple parameters to the Context Menu? whatt ?

  • By islami sohbet - 5:21 PM on November 24, 2008   Reply

    result for both swfs – I’m guessing that version 9 of the player has removed the old style way the context menus

  • By Ethan - 6:07 PM on November 24, 2008   Reply

    thanks for noticing, islami. Yeah, it’s funny that the old functionality got updated…

  • By banka şubeleri - 2:07 PM on December 8, 2008   Reply

    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.

ADD A COMMENT