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.

13 Responses to Custom Context Menus in Flash 8

  1. David R says:

    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)

  2. flashape says:

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

  3. Jon B says:

    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.

  4. Rick says:

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

  5. daniel larsen says:

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

  6. arkadas says:

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

  7. saglik says:

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

  8. veryy good site thanks You…

  9. motosiklet says:

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

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

  11. Ethan says:

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

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