MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 519

Actionscript language reference
Table of Contents

Advertisement

var showItem = true;
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,
ContextMenu.builtInItems
Availability
Flash Player 7.
Usage
my_cm.builtInItems:Object
Description
Property; an object that has the following Boolean properties:
,
rewind
forward_back
menu items from the specified ContextMenu object. These properties are enumerable and are set
to
by default.
true
Example
In this example, the built-in Quality and Print menu items are disabled for the ContextMenu
object
, which is attached to the current Timeline of the SWF file.
my_cm
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
menu items of the ContextMenu object,
var my_cm:ContextMenu = new ContextMenu();
for(eachProp in my_cm.builtInItems) {
var propName = eachProp;
// Change this to false to remove
TextField.menu
, and
. Setting these variables to
print
loop enumerates through all names and values of the built-in
for..in
my_cm
,
zoom
quality
false
.
ContextMenu.builtInItems
,
,
,
play
loop
removes the corresponding
519

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents