Flex: Menubar, menu click
- by javanes
I do not know why but I see that itemclick event on a menubar do not fired unless you click a sub item.
What is the clean way to handle clicks on menuitems which are on the top level and do not have sub menu items.
For example I want to fire an event whenever MenuItem B is clicked.
<?xml version="1.0"?>
<!-- menus/MenuBarControl.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:MenuBar id="myMenuBar" labelField="@label" itemClick="{itemClick(event)}" >
<mx:XMLList>
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem A-1"/>
<menuitem label="SubMenuItem A-2"/>
</menuitem>
<menuitem label="MenuItem B"/>
</mx:XMLList>
</mx:MenuBar>
</mx:Application>