Search Flex Components Free

Custom Search

March 24, 2008

Creating semi-transparent PopUpButton pop up menus in Flex





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


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

layout="vertical"

verticalAlign="top"

backgroundColor="white">



<mx:Style>

PopUpButton {

popUpStyleName: myCustomPopUpStyleName;

}



.myCustomPopUpStyleName {

fontWeight: normal;

textAlign: left;

backgroundAlpha: 0.4;

backgroundColor: white;

borderStyle: solid;

}

</mx:Style>



<mx:Script>

<![CDATA[

import mx.controls.Menu;



private var menu:Menu;



private function init():void {

menu = new Menu();

menu.labelField = "@label";

menu.dataProvider = xmlList;

popUpButton.popUp = menu;

menu.width = popUpButton.width;

}

]]>

</mx:Script>



<mx:XMLList id="xmlList">

<node label="Alert" />

<node label="Button" />

<node label="ButtonBar" />

<node label="CheckBox" />

<node label="ColorPicker" />

<node label="ComboBox" />

</mx:XMLList>



<mx:ApplicationControlBar dock="true">

<mx:PopUpButton id="popUpButton"

label="Please select an item..."

openAlways="true"

creationComplete="init();" />

</mx:ApplicationControlBar>



<mx:VBox backgroundAlpha="0.5"

backgroundColor="haloSilver"

width="100%"

height="100%" />



</mx:Application>



Related Flex Tutorials