Customitems (Contextmenu.customitems Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

}
for (var i in my_cm.customItems) {
trace("my_cm-> "+my_cm.customItems[i].caption);
}

customItems (ContextMenu.customItems property)

public customItems : Array
An array of ContextMenuItem objects. Each object in the array represents a context menu
item that you have defined. Use this property to add, remove, or modify these custom menu
items.
To add new menu items, you first create a new ContextMenuItem object, and then add it to
the
menu_mc.customItems
about creating new menu items, see the ContextMenuItem class entry.
Availability: ActionScript 1.0; Flash Player 7
Example
The following example creates a new custom menu item called
of "Send e-mail" and a callback handler named
added to the ContextMenu object,
menu is attached to a movie clip named
movie clip instance on your stage, and use the Property Inspector to name the instance
. In Test Movie mode, the new context menu item will appear if you bring up the
email_mc
context menu while your pointer is over the
var my_cm:ContextMenu = new ContextMenu();
var menuItem_cmi:ContextMenuItem = new ContextMenuItem("Send e-mail",
emailHandler);
my_cm.customItems.push(menuItem_cmi);
email_mc.menu = my_cm;
function emailHandler() {
trace("sending email");
}
See also
menu (Button.menu property)
(TextField.menu property)
array (for example, using
emailHandler
, using the
my_cm
email_mc
email_mc
,
menu (MovieClip.menu property)
,
push (Array.push method)
). For more information
Array.push()
menuItem_cmi
. The new menu item is then
array. Finally, the new
customItems
. To make this example work, create a
movie clip.
with a caption
,
menu
ContextMenu
447

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