ActionScript 2.0 Components Language Reference |
|
|
|
| MenuBar component > MenuBar.labelField | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
menuBarInstance.labelField
Property; a string that specifies which attribute of each XML node to use as the label text of the menu. The value of this property is also passed to any menus that are created from the menu bar. The default value is "label".
After the dataProvider property is set, this property is read-only.
The following example specifies that the name attribute of each XML node is to provide the label text for menu items.
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;
//Change label text to be read from "name".
my_mb.labelField = "name";
var my_menu:mx.controls.Menu = my_mb.addMenu({name:"File"});
my_menu.addMenuItem({name:"New", instanceName:"newInstance"});
my_menu.addMenuItem({name:"Open", instanceName:"openInstance"});
|
|
|
|