Set popup menu selected item : Popup Menu « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » Popup MenuScreenshots 
Set popup menu selected item
Set popup menu selected item
     
<?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.Create and show popup menuCreate and show popup menu
2.Bind Form data to popup menuBind Form data to popup menu
3.PopUp Menu Button EventsPopUp Menu Button Events
w___w___w__.__j_a_v_a___2s__._c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.