Create and show popup menu : Popup Menu « Components « Flex






Create and show popup menu

Create and show popup menu
     

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
    <mx:Script>
        
        import mx.controls.Menu;
        public var productMenu:Menu;
        public function initMenu(): void
        {
            productMenu = Menu.createMenu(null, Products.Department);
            productMenu.setStyle("disabledColor", 0xCC3366);
            productMenu.show(10,10);
        }
      
    </mx:Script>
    <mx:Model id="Products">
        <Root>
            <Department label="A">
                <children label="A1" />
                <children label="A2" />
                <children label="A3" />
            </Department>
            <Department label="B">
                <children label="C">
                    <children label="C1" />
                    <children label="C2" enabled="false" />
                </children>
            </Department>
        </Root>
    </mx:Model>
    <mx:Button label="Show menu" click="initMenu()" />
</mx:Application>

   
    
    
    
    
  








Related examples in the same category

1.Bind Form data to popup menuBind Form data to popup menu
2.PopUp Menu Button EventsPopUp Menu Button Events
3.Set popup menu selected itemSet popup menu selected item