Search Flex Components Free

Custom Search

December 19, 2007

Programmatically opening and closing ComboBox controls in Flex

The following examples show how you can programmatically open and close a ComboBox control’s drop down menu in Flex by using the open() and close() methods of the ComboBox class in Flex.
Full code after the jump.
The following example shows how you can open and close a ComboBox control’s drop down menu by rolling over a Button control on the display list.


<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white">
<mx:ApplicationControlBar dock="true"> <mx:Button label="open" rollOver="comboBox.open();" enabled="false" /> <mx:Button label="close" rollOver="comboBox.close();" enabled="false" /> </mx:ApplicationControlBar>
<mx:ComboBox id="comboBox" openDuration="2000" closeDuration="1000"> <mx:dataProvider> <mx:Array> <mx:Object label="one" /> <mx:Object label="two" /> <mx:Object label="three" /> <mx:Object label="four" /> <mx:Object label="five" /> <mx:Object label="six" /> </mx:Array> </mx:dataProvider> </mx:ComboBox>
</mx:Application>

Related Flex Tutorials