Using actionscript 3, can someone give an example how I can dynamically change the submenu items below?
<fx:Declarations>
<fx:XMLList id="menuData" xmlns="">
<menuitem label="Column A">
<menuitem label="Item A.1"/>
<menuitem label="Item A.2"/>
</menuitem>
<menuitem label="Column B">
<menuitem id="ItemB1" label="B.1"/>
<menuitem type="separator"/>
<menuitem label="Item B.2" type="check"/>
<menuitem label="Item B.3" type="check"/>
<menuitem id="myId" label="Item B.4">
<menuitem label="SubItem B.4.1"/>
<menuitem label="SubItem B.4.2"/>
</menuitem>
</menuitem>
...
</fx:XMLList>
<fx:Declarations>
...
<mx:MenuBar dataProvider="{menuData}" .../>
For example, suppose we want to replace submenu items B.4.1 and B.4.2 with:
<menuitem label="SubItem abc"/>
<menuitem label="SubItem def"/>
<menuitem label="SubItem ghi"/>
Grab the item by its label, or better, give it an id and use this to retreive it, and then replace its children.
You can easily do this utilizing E4X:
See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML.html for more information on this subject.