PopUpButton and Menu : PopUpButton « Components « Flex






PopUpButton and Menu

PopUpButton and Menu
     

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600" width="600">
    <mx:Script>
    
    import mx.controls.*;
    import mx.events.*;

    private var myMenu:Menu;
    private function initMenu():void { 
        myMenu = new Menu();
        var dp:Object = [{label: "A"},
                         {label: "B"},
                         {label: "C"}
                        ];
        myMenu.dataProvider = dp;
        myMenu.addEventListener("itemClick", changeHandler);
        popB.popUp = myMenu;
    }
    private function changeHandler(event:MenuEvent):void {
        var label:String = event.label;
        popTypeB.text=String("Moved to " + label);
        popB.label = "Put in: " + label;
        popB.close();
    }
  
    </mx:Script>
    <mx:VBox>
        <mx:PopUpButton id="popB" label="Edit" width="135" creationComplete="initMenu();"/>
        <mx:Spacer height="50"/>
        <mx:TextInput id="popTypeB"/>
    </mx:VBox>
</mx:Application>

   
    
    
    
    
  








Related examples in the same category

1.Using PopUpButton to display an optional menuUsing PopUpButton to display an optional menu
2.Creation Complete event for PopupButtonCreation Complete event for PopupButton
3.PopUpButton with MenuPopUpButton with Menu