User Guide
Menu.getMenuItemAt() 913
Menu.getMenuItemAt()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
menuInstance.getMenuItemAt(index)
Parameters
index An integer indicating the index of the node in the menu.
Returns
A reference to the specified node.
Description
Method; returns a reference to the specified child node of the menu.
Example
The following example initially creates two menus with a single menu item for each one. It
then adds a second menu item to the first menu by calling the
getmenuItemAt() method to
obtain the menu item from the second menu and add it to the first menu.
You first drag a Menu component to the library and then add the following code to Frame 1:
/**
Requires:
- Menu component in library
*/
import mx.controls.Menu;
// Create the Menu objects.
var first_menu:Menu = Menu.createMenu();
first_menu.addMenuItem({label:"1st Item"});
var second_menu:Menu = Menu.createMenu();
second_menu.addMenuItem({label:"1st Item 2nd Menu"});
// Add item from second_menu to 2nd position on first menu.
first_menu.addMenuItemAt(1, second_menu.getMenuItemAt(0));
// Show menu.
first_menu.show();