EasyManua.ls Logo

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

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 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...
446 ActionScript classes
}
}
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), onSelect (ContextMenu.onSelect handler),
customItems (ContextMenu.customItems property), hideBuiltInItems
(ContextMenu.hideBuiltInItems method)
, menu (MovieClip.menu property), menu
(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
ContextMenu - A ContextMenu 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.
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);

Table of Contents

Related product manuals