User Guide
Menu.addMenuItemAt() 907
Menu.addMenuItemAt()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
Usage 1:
menuInstance.addMenuItemAt(index, initObject)
Usage 2:
menuInstance.addMenuItemAt(index, childMenuItem)
Parameters
index An integer indicating the index position (among the child nodes) at which the item
is added.
initObject An object containing properties that initialize a menu item’s attributes. See
“About menu item XML attributes” on page 887.
childMenuItem An XML node object.
Returns
A reference to the added XML node.
Description
Method; Usage 1 adds a menu item (child node) at the specified location in the menu. The
menu item is constructed from the values supplied in the
initObject parameter. Usage 2
adds a menu item that is a prebuilt XML node (in the form of an XML object) at a specified
location in the menu. Adding a preexisting node removes the node from its previous location.
Example
The following example creates two menus, initially adding one menu item to each. The
example then adds two more menu items to the first menu, calling
addMenuItemAt() to add
a menu item in the second position by specifying its attributes. It then adds a menu item in
the third position by using the prebuilt menu item node from the second menu.