Menu event index : Menu Event « Components « Flex






Menu event index

Menu event index
   

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    backgroundColor="white">
    <mx:XMLListCollection id="myMenuData">
        <mx:XMLList>
            <menuitem label="File">
                <submenu label="New">
                    <submenu label="Pdf" />
                    <submenu label="Doc" />
                </submenu>
                <submenu label="Print" />
            </menuitem>
            <menuitem label="View">
                <submenu label="Pdf" />
                <submenu label="Doc" />
            </menuitem>
        </mx:XMLList>
    </mx:XMLListCollection>
    <mx:Script>
        
        import mx.events.MenuEvent;
        private function handleMenuClick(evt:MenuEvent):void
        {
            mx.controls.Alert.show(evt.item.@label);
            lastEvent.text = "Selection:" + evt.item.@label + ", Position: " + evt.index;
        }
      
    </mx:Script>
    <mx:MenuBar id="myMBar" itemClick="handleMenuClick(event)" dataProvider="{myMenuData}" labelField="@label" />
    <mx:Text id="lastEvent" />
</mx:Application>

   
    
    
  








Related examples in the same category

1.Get menu label from click eventGet menu label from click event
2.Menu with event listenerMenu with event listener
3.change event for MenuBarchange event for MenuBar
4.itemRollOver event for MenuBaritemRollOver event for MenuBar
5.Menu item click eventMenu item click event
6.Menu show eventMenu show event
7.Menu hide eventMenu hide event
8.Menu roll out eventMenu roll out event
9.Menu Item Roll Over eventMenu Item Roll Over event
10.Show the detailed information for MenuEvent
11.Create EventHandlers for Menu-Based ControlsCreate EventHandlers for Menu-Based Controls
12.A menu with a simple event listener.A menu with a simple event listener.
13.Handle events for the menu bar and for the pop-up submenus.Handle events for the menu bar and for the pop-up submenus.
14.Using Menu control eventsUsing Menu control events
15.Menu labelFieldMenu labelField