PopUpButton、ComboBox、Menu、之间的区别

先占个坑,以后补充!

 

<?xml version="1.0"?> <!-- controls/button/PopUpButtonMenu.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600" width="600"> <mx:Script> <!--[CDATA[ import mx.collections.ArrayCollection; import mx.controls.*; import mx.events.*; private var arr:Array = [{label:'sss'},{label:'ddd'},{label:'aaaa'},{label:'sssss'}]; private function initMenu():void { var myMenu:Menu = new Menu(); myMenu.dataProvider = list; myMenu.labelField = "@label" myMenu.addEventListener("itemClick", changeHandler); popB.popUp = myMenu; } // Define the event listener for the Menu control's change event. 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:XMLList id="list"> <menuitem label = "File"> <menuitem label = "new1"/> <menuitem label = "new2"/> <menuitem label = "new3"/> </menuitem> <menuitem label = "Edit"> </menuitem> <menuitem label = "Source"> <menuitem label = "new4"> <menuitem label = "new5"/> <menuitem label = "new6"/> <menuitem label = "new7"/> </menuitem> <menuitem label = "new8"> <menuitem label = "new9"/> <menuitem label = "new11"/> <menuitem label = "new12"/> </menuitem> <menuitem label = "new14"/> </menuitem> <menuitem label = "File"> <menuitem label = "new13"/> <menuitem label = "new15"/> <menuitem label = "new16"/> </menuitem> </mx:XMLList> <mx:VBox> <mx:Label text="Main button mimics the last selected menuItem."/> <mx:PopUpButton id="popB" label="Edit" width="135" creationComplete="initMenu();"/> <mx:Spacer height="50"/> <mx:TextInput id="popTypeB"/> </mx:VBox> <mx:ComboBox dataProvider="{arr}"/> </mx:Application>

你可能感兴趣的:(PopUpButton、ComboBox、Menu、之间的区别)