User Guide
ContextMenu.builtInItems 519
var showItem = true; // Change this to false to remove
var my_cm:ContextMenu = new ContextMenu(menuHandler);
my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler));
function menuHandler(obj, menuObj) {
if (showItem == false) {
menuObj.customItems[0].enabled = false;
} else {
menuObj.customItems[0].enabled = true;
}
}
function itemHandler(obj, item) {
//...put code here...
trace("selected!");
}
this.menu = my_cm;
When the user right-clicks or Control-clicks the Stage, the custom menu is displayed.
See also
ContextMenu.onSelect, ContextMenu.customItems, ContextMenu.hideBuiltInItems(),
MovieClip.menu, TextField.menu
ContextMenu.builtInItems
Availability
Flash Player 7.
Usage
my_cm.builtInItems:Object
Description
Property; an object that has the following Boolean properties: zoom, quality, play, loop,
rewind, forward_back, and print. Setting these variables to false removes the corresponding
menu items from the specified ContextMenu object. These properties are enumerable and are set
to
true by default.
Example
In this example, the built-in Quality and Print menu items are disabled for the ContextMenu
object
my_cm, which is attached to the current Timeline of the SWF file.
var my_cm:ContextMenu = new ContextMenu ();
my_cm.builtInItems.quality=false;
my_cm.builtInItems.print=false;
this.menu = my_cm;
Note: You cannot disable the Settings or About menu items from the context menu.
In the next example, a for..in loop enumerates through all names and values of the built-in
menu items of the ContextMenu object,
my_cm.
var my_cm:ContextMenu = new ContextMenu();
for(eachProp in my_cm.builtInItems) {
var propName = eachProp;