Click event for PopUpMenuButton : PopUpMenuButton « Components « Flex






Click event for PopUpMenuButton

Click event for PopUpMenuButton
     
<?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.Setup data provider for PopUpMenuButtonSetup data provider for PopUpMenuButton
2.PopUpMenuButton click eventPopUpMenuButton click event
3.Hard code data provider for PopUpMenuButton
4.Menu Separator for PopupMenuButtonMenu Separator for PopupMenuButton
5.Setup PopupMenuButtonSetup PopupMenuButton
6.Create PopUpMenuButton from ArrayCreate PopUpMenuButton from Array
7.Create a PopUpMenuButton control using an E4X XML data provider.Create a PopUpMenuButton control using an E4X XML data provider.
8.Use PopUpMenuButton change event to set the labelUse PopUpMenuButton change event to set the label
9.Use XMLListCollection as the PopUpMenuButton data sourceUse XMLListCollection as the PopUpMenuButton data source
10.Item click event for PopUpMenuButtonItem click event for PopUpMenuButton
11.PopUpMenuButton and XMLList data providerPopUpMenuButton and XMLList data provider
12.how the PopUpMenuButton generates events and how an application can handle themhow the PopUpMenuButton generates events and how an application can handle them
13.Creating a PopUpMenuButton controlCreating a PopUpMenuButton control
14.To use a dynamic label property, use a PopUpMenuButton control change event listenerTo use a dynamic label property, use a PopUpMenuButton control change event listener