Using PopUpButton to display an optional menu : PopUpButton « Components « Flex






Using PopUpButton to display an optional menu

Using PopUpButton to display an optional menu
  

<?xml version='1.0' encoding='UTF-8'?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.controls.Alert;
        import mx.events.*;
        import mx.controls.Menu;
        
        public var menuItems:Object =   [{label:'One'},{label:'Two'},{label:'Three'}];
        
        public var thisMenu:Menu = Menu.createMenu(null,menuItems,false);
        
        public function handleItemClick(event:MenuEvent):void{
            menuBtn.label = event.label;
        }
      
    </mx:Script>
    <mx:PopUpButton id="menuBtn"
        creationComplete="thisMenu.addEventListener('itemClick',handleItemClick);"
        popUp="{thisMenu}" />
</mx:Application>

   
    
  








Related examples in the same category

1.Creation Complete event for PopupButtonCreation Complete event for PopupButton
2.PopUpButton and MenuPopUpButton and Menu
3.PopUpButton with MenuPopUpButton with Menu