Copy (Contextmenu.copy Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

}
}
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
menu (Button.menu property)
customItems (ContextMenu.customItems property)
(ContextMenu.hideBuiltInItems method)
(TextField.menu property)

copy (ContextMenu.copy method)

public copy() : ContextMenu
Creates a copy of the specified ContextMenu object. The copy inherits all the properties of
the original menu object.
Availability: ActionScript 1.0; Flash Player 7
Returns
- A ContextMenu object.
ContextMenu
Example
This example creates a copy of the ContextMenu object named
items are hidden, and adds a menu item with the text "Save...". It then creates a copy of
and 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);
446
ActionScript classes
,
onSelect (ContextMenu.onSelect handler)
,
menu (MovieClip.menu property)
, which inherits all the properties of the original menu.
clone_cm
,
hideBuiltInItems
whose built-in menu
my_cm
,
,
menu
my_cm

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF