| Methods | Properties | Effects | Events | Styles | Examples | Frames | No Frames |
The ComboBox control contains a drop-down List from which the user can select a single value. Its functionality is very similar to that of the SELECT form element in HTML. The ComboBox can be editable in which case the user can type entries into the TextInput portion of the ComboBox that are not in the List.
MXML Syntax
The <mx:ComboBox> tag inherits all the properties of its parent classes, and the following properties:
<mx:ComboBoxClick here to view the Examples
dataProvider="No default."
dropdownWidth="Size wide enough to hold text."
editable="false|true"
labelField="No default."
labelFunction="No default."
rowCount="5"
selectedIndex="No default."
selectedItem="No default."
change="Event handler; no default."
close="Event handler; no default."
enter="Event handler; no default."
itemRollOver="Event handler; no default."
itemRollOut="Event handler; no default."
open="Event handler; no default."
scroll="Event handler; no default."
/>
See Also
List
mx.effects.Tween
mx.managers.PopUpManager
| Methods | |
| close(
)
:
VoidHides the dropdown list. |
| layoutChildren(
)
:
Void Make sure the dropdown width is the same as the rest of the ComboBox |
| measure(
)
:
Void Makes sure the control is at least 100 pixels wide, and tall enough to fit one line of text in the TextInput are of the control. |
| open(
)
:
VoidDisplays the dropdown list. |
| Methods inherited from class mx.core.UIComponent |
drawFocus
getFocus
getFocusManager
setEnabled
setFocus
|
| Properties | |
| dataProvider:
Object The dataProvider for the ComboBox control. |
| dropdown:
Object
[Read-Only]
A reference to the List that acts as the dropdown in the ComboBox. |
| dropdownWidth:
NumberWidth of the dropdown, in pixels. |
| labelField:
StringName of the field in the objects of the dataProvider array to display as the label. |
| labelFunction:
FunctionUser-supplied function to run on each item to determine its label. |
| prompt:
Object The prompts for the ComboBox control. |
| rowCount:
NumberMaximum number of rows visible in the ComboBox control list. |
| selectedIndex:
Number Index of the selected item in the drop-down list. |
| selectedItem:
Object Contains a reference to the selected item in the dataProvider. |
static | version:
StringVersion string for this class. |
| Properties inherited from class mx.controls.ComboBase |
dataProvider
editable
length
restrict
selectedIndex
selectedItem
text
textField
value
version
|
| Properties inherited from class mx.core.UIComponent |
enabled
errorString
tabEnabled
tabIndex
version
|
| Effects |
| Effects inherited from class mx.core.UIComponent |
focusInEffect
focusOutEffect
|
| Effects inherited from class mx.core.UIObject |
creationCompleteEffect
hideEffect
mouseDownEffect
mouseOutEffect
mouseOverEffect
mouseUpEffect
moveEffect
resizeEffect
showEffect
|
| Events | |
change | Broadcast when the selectedIndex/selectedItem property changes as a result of user interaction. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, change. You can access the attributes of the selected item as: evt.target.selectedItem.label evt.target.selectedItem.data |
close | Broadcast when dropdown is dismissed because the user selected an item in the dropdown, clicked outside of the dropdown, or clicked the dropdown button while the dropdown was displayed. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, close. |
enter | Broadcast if the ComboBox editable property is set to true and the user presses the Enter key while typing in the TextInput. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, enter. |
itemRollOut | Broadcast when list items are rolled out. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, itemRollOut. The event object's index property contains the index of the item that was rolled out. |
itemRollOver | Broadcast when items are rolled over. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, itemRollOver. The event object's index property contains the index of the item that was rolled over. |
modelChanged | Broadcast when the dataprovider is changed. Commonly used to add an initial prompt to the dataProvider so that the first selection is something like "Select a name...". The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, modelChanged. |
open | Broadcast when the user clicks on the dropdown button to display the dropdown. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, open. |
scroll | Broadcast when the user scrolls the ComboBox's dropdown list. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, scroll. |
| Events inherited from class: mx.core.UIComponent |
focusIn focusOut invalid keyDown keyUp valid valueCommitted |
| Styles | |
alternatingRowColors |
Type:
Array
CSS Inheritance:
yesColors for rows in an alternating pattern. Value can be an Array of two of more colors. Only used if backgroundColor is not specified |
closeDuration |
Type:
Number
Format:
Time
CSS Inheritance:
noLength of a close transition, in milliseconds. The default value is 250. |
closeEasing |
Type:
String
Format:
Time
CSS Inheritance:
noEasing function to control component tweening. |
openDuration |
Type:
Number
Format:
Time
CSS Inheritance:
noLength of an open transition, in milliseconds. The default value is 250. |
openEasing |
Type:
String
Format:
Time
CSS Inheritance:
noEasing function to control component tweening. |
rollOverColor |
Type:
Number
Format:
Color
CSS Inheritance:
yesColor of the background when the user rolls over an item. The default value is 0x0EFFD6. |
selectionColor |
Type:
Number
Format:
Color
CSS Inheritance:
yesColor of the background when the user selects an item. The default value is 0x0DFFC1. |
selectionEasing |
Type:
String
CSS Inheritance:
noReference to an easing equation (function) used for controlling programmatic tweening. |
| Styles inherited from class mx.core.UIObject |
color
fontFamily
fontSize
fontStyle
fontWeight
horizontalGap
leading
marginLeft
marginRight
textAlign
textDecoration
textIndent
verticalGap
|
| Method Detail |
close(
)
:
Void
layoutChildren(
)
:
Void
measure(
)
:
Void
open(
)
:
Void
| Property Detail |
dataProvider:
Object
dropdown:
Object
[Read-Only]
dropdownWidth:
Number
labelField:
String
label on each array object and display it. However, if the dataProvider objects do not contain a label property, you can set the labelField property to use a different property.
labelFunction:
Function
label on each array object to determine its label. However, some data sets do not have a label property, or do not have another property that can be used for displaying as a label. An example is a data set that has lastName and firstName fields but you want to display full names. You use labelFunction to specify a callback function that uses the appropriate fields and return a displayable string.
prompt:
Object
rowCount:
Number
selectedIndex:
Number
selectedItem:
Object
undefined if the user types any text into the text field. It has a value only if the user selects an item from the drop-down list, or if it is set programmatically.
static
version:
String
| Examples |
| SimpleComboBox.mxml |
|
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/controls/ComboBox.html
Comments
Teseo2005 said on Oct 20, 2005 at 8:18 PM : smgilson said on Oct 21, 2005 at 5:47 AM :