User Guide
890 Menu component (Flash Professional only)
When the user selects one of the items, the current selection automatically changes, and a
change event is broadcast to all listeners on the root menu. The currently selected item in a
radio group is available in ActionScript through the
selection property, as follows:
var selectedMenuItem = myMenu.alignment_group.selection;
myMenu.alignment_group = myMenu.center_item;
Each groupName value must be unique within the scope of the root menu instance.
Exposing menu items to ActionScript
You can assign each menu item a unique identifier in the instanceName attribute, which
makes the menu item accessible directly from the root menu. For example, the following
XML code provides
instanceName attributes for each menu item:
<menu>
<menuitem label="Item 1" instanceName="item_1" />
<menuitem label="Item 2" instanceName="item_2" >
<menuitem label="SubItem A" instanceName="sub_item_A" />
<menuitem label="SubItem B" instanceName="sub_item_B" />
</menuitem>
</menu>
You can use ActionScript to access the corresponding instances and their attributes directly
from the menu component, as follows:
var aMenuItem = myMenu.item_1;
myMenu.setMenuItemEnabled(item_2, true);
var aLabel = myMenu.sub_item_A.attributes.label;
NOTE
The selected attribute should be modified only with the setMenuItemSelected() method.
You can directly examine the
selected attribute, but it returns a string value of true
or
false.
NOTE
Each instanceName attribute must be unique within the scope of the root menu
component instance (including all of the submenus of root).