ComboBox in Flex4


 

ComboBox in Flex4

In Flex4 Combobox is called a spark Combobox control. DropDownListBase control is the base class of the combobox control.

In Flex4 Combobox is called a spark Combobox control. DropDownListBase control is the base class of the combobox control.

ComboBox in Flex4:

In Flex4 Combobox is called a spark Combobox control. DropDownListBase control is the base class of the combobox control. Combobox control works like a DropDownList control. When we click on the combobox control for choosing a item it opens a DropDownList. It contains data item and the area which contains the data item is called a prompt area of the control .You provide the data to the Combobox control by using the DataProvider Property. It is the default property of the Combobox control. The tag of the Combobox control is <s:ComboBox>......</s:ComboBox>.

Example:

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

<!-- ComboBox control Example -->

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx" width="480">

<s:Panel title="ComboBox control Example" width="437">

<s:Label text="The selected index value is: {cmbox.selectedIndex}" x="10" y="10" color="Green"/>

<s:Label text="The selected item name is: {cmbox.selectedItem}" x="10" y="41" color="Green"/>

<s:ComboBox id="cmbox" width="140" x="291" y="10" color="#990000">

<s:dataProvider>

<mx:ArrayList>

<fx:String>HTML</fx:String>

<fx:String>CSS</fx:String>

<fx:String>PHP</fx:String>

<fx:String>FLEX3</fx:String>

<fx:String>FLEX4</fx:String>

</mx:ArrayList>

</s:dataProvider>

</s:ComboBox>

</s:Panel>

</s:Application>

Output:



Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Ads