Search Flex Components Free

Custom Search

March 24, 2008

Adding checkboxes, radiobuttons, and sub-menus to a Flex PopUpButton control’s pop up menu

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

<mx:Application xmlns:mx=""





PopUpButton {

popUpStyleName: myCustomPopUpStyleName;


.myCustomPopUpStyleName {

fontWeight: normal;

textAlign: left;



<mx:XML id="xmlDP">


<node label="The quick brown fox jumped over the lazy dog." />

<node label="Lorem ipsum (disabled)." enabled="false" />

<node type="separator" />

<node label="parent">

<node label="child1" />


<node label="parent (disabled)" enabled="false">

<node label="child1" />

<node label="child2" />

<node label="child3" />


<node type="separator" />

<node label="type=check" id="ch" type="check" toggled="true" />

<node label="type=check" id="ch" type="check" toggled="true" enabled="false" />

<node type="separator" />

<node label="1) type=radio" type="radio" groupName="radioGroup" toggled="true" />

<node label="2) type=radio" type="radio" groupName="radioGroup" />

<node label="3) type=radio" type="radio" groupName="radioGroup" />

<node label="4) type=radio" type="radio" groupName="radioGroup" enabled="false" />





import mx.controls.Menu;

private var menu:Menu;

private function init():void {

menu = new Menu();

menu.labelField = "@label";

menu.dataProvider = xmlDP;

menu.showRoot = false;

menu.width = popUpButton.width;

popUpButton.popUp = menu;




<mx:PopUpButton id="popUpButton"

label="Please select an item"


creationComplete="init();" />


Related Flex Tutorials