User Guide

542 Chapter 6: Components Dictionary
Normal menu items
The
Normal Item menu item doesnt have a type attribute, which means that the type attribute
defaults to
normal. Normal items can be command activators or submenu activators, depending
on whether they have nested subitems.
Separator menu items
A menu item whose
type attribute is set to separator acts as a visual divider in a menu.
The following XML creates three menu items, Top, Middle, and Bottom, with separators
between them:
<menu>
<menuitem label="Top" />
<menuitem type="separator" />
<menuitem label="Middle" />
<menuitem type="separator" />
<menuitem label="Bottom" />
</menu>
All separator items are disabled. Clicking on or rolling over a separator has no effect.
Check box menu items
A menu item whose
type attribute is set to check acts as check box item in the menu; when the
selected attribute is set to true, a check mark appears beside the menu items label. When a
check box item is selected, its state automatically toggles, and a
change event is broadcast to all
listeners on the root menu. The following example defines three check box menu items:
<menu>
<menuitem label="Apples" type="check" instanceName="buyApples"
selected="true" />
<menuitem label="Oranges" type="check" instanceName="buyOranges"
selected="false" />
<menuitem label="Bananas" type="check" instanceName="buyBananas"
selected="false" />
</menu>
You can use the instance names in ActionScript to access the menu items directly from the menu
itself, as in the following example:
myMenu.setMenuItemSelected(myMenu.buyapples, true);
myMenu.setMenuItemSelected(myMenu.buyoranges, false);
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.