Drag an instance of the MenuBar component onto the Stage, and enter the instance name
in the Property inspector. Add the following code to Frame 1 of the timeline:
my_mb
/**
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
first position of the MenuBar instance
Drag an instance of the MenuBar component onto the Stage, and enter the instance name
in the Property inspector. Add the following code to Frame 1 of the timeline:
my_mb
/**
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.
958
MenuBar component (Flash Professional only)
myDP_xml
.
my_mb
. It adds the menu to the
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers