ContextMenu.copy()
Availability
Flash Player 7.
Usage
my_cm.copy() : ContextMenu
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
are hidden, and adds a menu item with the text "Save...". It then creates a copy of
assigns it to the variable
var my_cm:ContextMenu = new ContextMenu();
my_cm.hideBuiltInItems();
var menuItem_cmi:ContextMenuItem = new ContextMenuItem("Save...",
saveHandler);
my_cm.customItems.push(menuItem_cmi);
function saveHandler(obj, menuItem) {
// saveDocument();
// custom function (not shown)
trace("something");
}
clone_cm = my_cm.copy();
this.menu = my_cm;
for (var i in clone_cm.customItems) {
trace("clone_cm-> "+clone_cm.customItems[i].caption);
}
for (var i in my_cm.customItems) {
trace("my_cm-> "+my_cm.customItems[i].caption);
}
, which inherits all the properties of the original menu.
clone_cm
whose built-in menu items
my_cm
my_cm
ContextMenu.copy()
and
217
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?