Use to define the data for the Menu control
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.controls.Menu;
private function createAndShow():void {
var myMenu:Menu = Menu.createMenu(null, myMenuData, false);
myMenu.labelField="@label";
myMenu.show(10, 10);
}
</mx:Script>
<mx:XML format="e4x" id="myMenuData">
<root>
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem A-1" enabled="false" />
<menuitem label="SubMenuItem A-2" />
<menuitem label="SubMenuItem A-3" />
<menuitem label="SubMenuItem A-4" />
<menuitem label="SubMenuItem A-5" />
<menuitem label="SubMenuItem A-6" />
<menuitem label="SubMenuItem A-7" />
<menuitem label="SubMenuItem A-8" />
<menuitem label="SubMenuItem A-9" />
</menuitem>
<menuitem label="MenuItem B" type="check" toggled="true" />
<menuitem label="MenuItem C" type="check" toggled="false" />
<menuitem type="separator" />
<menuitem label="MenuItem D">
<menuitem label="SubMenuItem D-1" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-2" type="radio" groupName="one" toggled="true" />
<menuitem label="SubMenuItem D-3" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-4" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-5" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-6" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-7" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-8" type="radio" groupName="one" />
</menuitem>
</root>
</mx:XML>
<mx:VBox>
<mx:Button id="myButton" label="Open Menu" click="createAndShow();" />
</mx:VBox>
</mx:Application>
Related examples in the same category