Model for Menu
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
<mx:Script>
import mx.controls.Menu;
public var productMenu:Menu;
public function initMenu(): void
{
productMenu = Menu.createMenu(null, Products.Department);
productMenu.setStyle("disabledColor", 0xCC3366);
productMenu.show(10,10);
}
</mx:Script>
<mx:Model id="Products">
<Root>
<Department label="{menuName.text}">
<children label="{item1.text}" />
<children label="{item2.text}" />
<children label="{item3.text}" />
</Department>
</Root>
</mx:Model>
<mx:Button label="Show Products" click="initMenu()" />
<mx:Form>
<mx:FormItem label="Third Submenu title">
<mx:TextInput id="menuName" text="Clothing" />
</mx:FormItem>
<mx:FormItem label="Item 1">
<mx:TextInput id="item1" text="Sweaters" />
</mx:FormItem>
<mx:FormItem label="Item 2">
<mx:TextInput id="item2" text="Shoes" />
</mx:FormItem>
<mx:FormItem label="Item 3">
<mx:TextInput id="item3" text="Jackets" />
</mx:FormItem>
</mx:Form>
</mx:Application>
Related examples in the same category