Show the detailed information for MenuEvent : Menu Event « Components « Flex






Show the detailed information for MenuEvent

      
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600"
    width="600" creationComplete="initData();">
    <mx:Script>
        
        import mx.events.*;
        import mx.controls.*;
        private function initData():void {
            Menu(p1.popUp).selectedIndex=2;
        }
        public function itemClickHandler(event:MenuEvent):void {
            Alert.show("itemClick event label: " + event.label  + " \nindex: " + event.index
                    + " \nitem.label: " + event.item.label
                    + " \nitem.data: " + event.item.data);
        }
        public function clickHandler(event:MouseEvent):void {
            Alert.show(" Click Event currentTarget.label: " + event.currentTarget.label);
        }
        [Bindable]
        public var menuDP:Array = [
            {label: "A", data: "a"},
            {label: "B", data: "b"},
            {label: "C", data: "c"},
            {label: "D", data: "d"},
            {label: "E", data: "e"}
        ];
      </mx:Script>
    <mx:PopUpMenuButton id="p1" showRoot="true" dataProvider="{menuDP}" click="clickHandler(event)" itemClick="itemClickHandler(event);" />
</mx:Application>

   
    
    
    
    
    
  








Related examples in the same category

1.Get menu label from click eventGet menu label from click event
2.Menu event indexMenu event index
3.Menu with event listenerMenu with event listener
4.change event for MenuBarchange event for MenuBar
5.itemRollOver event for MenuBaritemRollOver event for MenuBar
6.Menu item click eventMenu item click event
7.Menu show eventMenu show event
8.Menu hide eventMenu hide event
9.Menu roll out eventMenu roll out event
10.Menu Item Roll Over eventMenu Item Roll Over event
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