User Guide
544 Chapter 6: Components Dictionary
About initialization object properties (Flash Professional only)
The
initObject (initialization object) parameter is a fundamental concept in creating the layout
for the Menu component. This parameter is an object with properties. Each property represents
one of the possible the XML attributes of a menu item. (For a description of the properties
allowed in the
initObject parameter, see “About menu item XML attributes” on page 541.)
The
initObject parameter is used in the following methods:
• Menu.addMenuItem()
• Menu.addMenuItemAt()
• MenuDataProvider.addMenuItem()
• MenuDataProvider.addMenuItemAt()
The following example creates an initObject parameter with two properties, label and
instanceName:
var i = myMenu.addMenuItem({label:"myMenuItem", instanceName:"myFirstItem"});
Several of the properties work together to create a particular type of menu item. You assign
specific properties to create certain types of menu items (normal, separator, check box, or
radio button).
For example, you can initialize a normal menu item with the following
initObject parameter:
myMenu.addMenuItem({label:"myMenuItem", enabled:true, icon:"myIcon",
instanceName:"myFirstItem"});
You can initialize a separator menu item with the following initObject parameter:
myMenu.addMenuItem({type:"separator"});
You can initialize a check box menu item with the following initObject parameter:
myMenu.addMenuItem({type:"check", label:"myMenuCheck", enabled:false,
selected:true, instanceName:"myFirstCheckItem"})
You can initialize a radio button menu item with the following initObject parameter:
myMenu.addMenuItem({type:"radio", label:"myMenuRadio1", enabled:true,
selected:false, groupName:"myRadioGroup" instanceName:"myFirstRadioItem"})
You should treat the instanceName, groupName, and type attributes of a menu item as read-only.
You should set them only while creating an item (for example, in a call to
addMenuItem()).
Modifying these attributes after creation may produce unpredictable results.
Menu parameters (Flash Professional only)
There are no authoring parameters for the Menu component.
You can write ActionScript to control the Menu component using its properties, methods, and
events. For more information, see “Menu class (Flash Professional only)” on page 551.