Flex: Menubar, menu click
Posted
by javanes
on Stack Overflow
See other posts from Stack Overflow
or by javanes
Published on 2010-03-11T09:21:51Z
Indexed on
2010/05/13
0:54 UTC
Read the original article
Hit count: 302
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>
© Stack Overflow or respective owner