User Guide
582 Chapter 6: Components Dictionary
myMenu = myMenuBar.addMenu("File");
myMenu.addMenuItem({label:"New", instanceName:"newInstance"});
myMenu.addMenuItem({label:"Open", instanceName:"openInstance"})
Usage 2: The following example adds a Font menu with the menu items Bold and Italic that are
defined in the MenuDataProvider instance
myMenuDP2:
var myMenuDP2 = new XML();
myMenuDP2.addMenuItem({type:"check", label:"Bold", instanceName:"check1"});
myMenuDP2.addMenuItem({type:"check", label:"Italic", instanceName:"check2"});
menu = myMenuBar.addMenu("Font",myMenuDP2);
MenuBar.addMenuAt()
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
Usage 1:
myMenuBar.addMenuAt(index, label)
Usage 2:
myMenuBar.addMenuAt(index, label, menuDataProvider)
Parameters
index
An integer indicating the position where the menu should be inserted. The first position
is 0. To append to the end of the menu, call
MenuBar.addMenu(label).
label A string indicating the label of the new menu.
menuDataProvider An XML or XMLNode instance that describes the menu. If the value is an
XML instance, the instance’s first child is used.
Returns
A reference to the new Menu object.
Description
Method; Usage 1 adds a single menu and menu activator at the specified index with the specified
label. Usage 2 adds a single menu and a labeled menu activator at the specified index. The content
for the menu is defined in the
menuDataProvider parameter.
Example
Usage 1: The following example places a menu to the left of all MenuBar menus:
menu = myMenuBar.addMenuAt(0,"Toreador");
menu.addMenuItem("About Macromedia Flash", instanceName:"aboutInst");
menu.addMenuItem("Preferences", instanceName:"PrefInst");