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.