ActionScript 2.0 Components Language Reference |
|
|
|
| Menu component > Menu.getMenuItemAt() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
menuInstance.getMenuItemAt(index)
index An integer indicating the index of the node in the menu.
A reference to the specified node.
Method; returns a reference to the specified child node of the menu.
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();
|
|
|
|