Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > Menu component > About initialization object properties | |||
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.)
The initObject parameter is used in the following methods:
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.
Flash CS3