I donโt know why, but I see that the itemclick event in the menu bar does not fire unless you click on an item.
What is the clean way to handle clicks on menu items that are at the top level and have no submenu items.
For example, I want to fire an event whenever MenuItem B is pressed.
<?xml version="1.0"?>
<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>
source
share