User Guide

958 MenuBar component (Flash Professional only)
Drag an instance of the MenuBar component onto the Stage, and enter the instance name
my_mb in the Property inspector. Add the following code to Frame 1 of the timeline:
/**
Requires:
- MenuBar component on Stage (instance name: my_mb)
*/
var my_mb:mx.controls.MenuBar;
var my_menu:mx.controls.Menu = my_mb.addMenuAt(0, "Flash");
my_menu.addMenuItem({label:"About Macromedia Flash",
instanceName:"aboutInst"});
my_menu.addMenuItem({label:"Preferences", instanceName:"PrefInst"});
Usage 2: The following example adds an Edit menu with the menu items Undo, Redo, Cut,
and Copy, which are defined in the XML data provider
myDP_xml. It adds the menu to the
first position of the MenuBar instance
my_mb.
Drag an instance of the MenuBar component onto the Stage, and enter the instance name
my_mb in the Property inspector. Add the following code to Frame 1 of the timeline:
/**
Requires:
- MenuBar component on Stage (instance name: my_mb)
*/
var my_mb:mx.controls.MenuBar;
var myDP_xml:XML = new XML();
myDP_xml.addMenuItem({label:"Undo", instanceName:"undoInst"});
myDP_xml.addMenuItem({label:"Redo", instanceName:"redoInst"});
myDP_xml.addMenuItem({type:"separator"});
myDP_xml.addMenuItem({label:"Cut", instanceName:"cutInst"});
myDP_xml.addMenuItem({label:"Copy", instanceName:"copyInst"});
my_mb.addMenuAt(0, "Edit", myDP_xml);
MenuBar.dataProvider
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.