Understanding the Menu component: view and data
Conceptually, the Menu component consists of a data model and a view that displays the
data. The Menu class provides the view and contains the visual configuration methods. The
MenuDataProvider class
DataProvider API does to the Array object); these methods let you externally construct data
providers and add them to multiple menu instances. The data provider broadcasts any
changes to all of its client views. (See
A Menu instance is a hierarchical collection of XML elements that correspond to individual
menu items. The attributes define the behavior and appearance of the corresponding menu
item on the screen. The collection is easily translated to and from XML, which is used to
describe menus (the
menu
class is the basis for the model underlying the Menu component.
A simple menu with two items can be described in XML with two menu item subelements:
<menu>
<menuitem label="Up" />
<menuitem label="Down" />
</menu>
The tag names of the XML nodes (
and their nesting relationships are used in the menu.
About hierarchical menus
To create hierarchical menus, embed XML elements within a parent XML element, as follows:
<menu>
<menuitem label="MenuItem A" >
<menuitem label="SubMenuItem 1-A" />
<menuitem label="SubMenuItem 2-A" />
</menuitem>
<menuitem label="MenuItem B" >
<menuitem label="SubMenuItem 1-B" />
<menuitem label="SubMenuItem 2-B" />
</menuitem>
</menu>
This converts the parent menu item into a pop-up menu anchor, so it does not generate
events when selected.
886
Menu component (Flash Professional only)
adds methods to the global XML prototype object (much like the
"MenuDataProvider class" on page
tag) and items (the
menuitem
and
menu
tag). The built-in ActionScript XML
) are not important; the attributes
menuitem
933.)
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers