Share on Google+Share on Google+

PopUp Button in Flex

In the current tutorial you will come to know about PopUp Button control of Flex. The PopUpButton consists of a main button and smaller buttons, which is called pop-up button. The main button is called control button. The examples will help you to learn PopUpButton more effectively

PopUpButton in Flex :

The PopUpButton in Flex consists of a main button and  smaller buttons, which is called pop-up button. The main button is called control button.

When we click a pop-up button opens a second control called the pop-up control. After selecting any pop-up button, the button control closes the pop-up control. 

We can use this control for displaying the Flex control as the pop-up control. PopUpButton is a subclass of Button class and it inherits all the method, properties of this class.

<mx:PopUpButton> tag is used to decalare a PopUpButton. We can put an id for reference of this control as it could be required in any other part of the file or in the ActionScript file.

POP UP Button in Flex Example: 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="" layout="absolute">



import mx.controls.*;


private var pop:Menu;

public function initMenu():void{

pop=new Menu();

var dp:Object=[{label:"Sun"},{label:"Adobe"},{label:"Mozilla"}]






public function itemClickHandler(event:MenuEvent):void{

var msg:String=event.item.label;


disp.text=String("JavaFx :"+msg);

popUp.label=String("JavaFx :"+msg);



disp.text=String("Flex :"+msg);

popUp.label=String("Flex :"+msg);



disp.text=String("XUL :"+msg);

popUp.label=String("XUL :"+msg);







<mx:Panel title="PopUpButton Example" horizontalCenter="10" verticalCenter="10" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">

<mx:Text text="Click any one button from the below PopUpButton"/>

<mx:PopUpButton id="popUp" label="RIA" creationComplete="initMenu()" />

<mx:Spacer height="20"/>

<mx:TextInput id="disp"/>





Posted on: January 27, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.