EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 338

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
338 Chapter 12: ActionScript Dictionary
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 root Timeline of the SWF file.
var my_cm = new ContextMenu ();
my_cm.builtInItems.quality=false;
my_cm.builtInItems.print=false;
_root.menu = my_cm;
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.
my_cm = new ContextMenu();
for(eachProp in my_cm.builtInItems) {
var propName = eachProp;
var propValue = my_cm.builtInItems[propName];
trace(propName + ": " + propValue;
}
ContextMenu.copy()
Availability
Flash Player 7.
Usage
my_cm.copy()
Parameters
None.
Returns
A ContextMenu object.
Description
Method; creates a copy of the specified ContextMenu object. The copy inherits all the properties
of the original menu object.
Example
This example creates a copy of the ContextMenu object named my_cm whose built-in menu items
are hidden, and adds a menu item with the text “Save...”. It then creates a copy of my_cm and
assigns it to the variable
clone_cm, which inherits all the properties of the original menu.
my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
my_cm.customItems.push(new ContextMenuItem("Save...", saveHandler);
function saveHandler (obj, menuItem) {
saveDocument(); // custom function (not shown)
}
clone_cm = my_cm.copy();

Table of Contents

Related product manuals