MenuBar.labelField

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

menuBarInstance.labelField

Description

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.

Example

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"});