Avg. Rating 4.2

Problem

The context menu for pop up windows does not use the application context menu

Solution

Access the 'systemManager' property of the application to set the context menu

Detailed explanation

By default the context menu for an application has all of the built in items removed except 'Print'. This is done in the mx.core Application class when the application is initialized. So by default all display object in the application will have this context menu becuase they are all children of the application, except for pop up windows. Why?

Popup windows are children of SystemManager which in itself is a movie clip. The context menu for SystemManager does not have the built in items removed by default. So all pop up windows have the full default Flash Player context menu. In order to remove the built in items you have to access this movieclip. This is done through the 'systemManager' property of the application.

To remove the context menu from pop up windows the easiest thing to do is to add this line of code in your main application file when your application initializes

MovieClip(systemManager).contextMenu = this.contextMenu.clone();

This will make the context menu of the SystemManager the same as the application.

If you plan on adding items to the application context menu and don't want those items in the systemManager context menu you can also use

var cm:ContextMenu = new ContextMenu();

cm.hideBuiltInItems();

MovieClip(systemManager).contextMenu = cm;

This is probably an oversite by the framework developement team and perhaps it will be fixed in a future release.

Report abuse

Related recipes