I have had a long standing problem that has been plaguing one of my recent projects. I wanted to remove the ContextMenu right-click items. The way it would normally be done is to create a new ContextMenu and then use the hideBuiltInItems(); to remove all the items from the right-click menu except for the Settings and About information for the Flash Player:
// hide right-click menu items
var menu:ContextMenu = new ContextMenu();
this.contextMenu = menu;
Placing this code in the main application file for your Flex project seems to work, at first. Then you realize that you while dragging items, you can quickly right-click and see the full Flash Player menu. I also found that if you right-click on a Flex Menu item the full Flash Player menu will also be visible. Thinking this was some sort of bug, I posted it to FlexCoders. I waited and waited for any response, but got bupkus, nada, crickets. However, just by chance, I ran across Adobe’s Flex cookbook beta web site today and there was a post titled “Removing the context menu build in items from pop up windows”. Holy Cow!!
Apparently, Popup windows (and I imagine Menus and Drag objects) are children of the SystemManager, not the Application. They will just ignore the regular command for removing the right-click menu. You have to remove the ConextMenu by using additional code in your main application file:
//Remove ContextMenu from all SystemManager Menu items and PopUp
MovieClip(systemManager).contextMenu = this.contextMenu.clone();
This makes the context menu of the SystemManager the same as that of the Application. Thanks “aalderson”, whoever you are, you rock!