Flash 8 Documentation |
|||
| Components Language Reference > ComboBox component > ComboBox class | |||
Inheritance MovieClip > UIObject class > UIComponent class > ComboBase > ComboBox
ActionScript Class Name mx.controls.ComboBox
The ComboBox component combines three separate subcomponents: Button, TextInput, and List. Most of the methods, properties, and events of each subcomponent are available directly from the ComboBox component and are listed in the summary tables for the ComboBox class.
The drop-down list in a combo box is provided either as an array or as a data provider. If you use a data provider, the list changes at runtime. You can change the source of the ComboBox data dynamically by switching to a new array or data provider.
Items in a combo box list are indexed by position, starting with the number 0. An item can be one of the following:
label property and a data property |
NOTE |
|
An object may use the ComboBox.labelFunction or ComboBox.labelField property to determine the |
If the item is a primitive data type other than String, it is converted to a string. If an item is an object, the label property must be a string and the data property can be any ActionScript value.
ComboBox methods to which you supply items have two parameters, label and data, that refer to the properties above. Methods that return an item return it as an object.
A combo box defers the instantiation of its drop-down list until a user interacts with it. Therefore, a combo box may appear to respond slowly on first use.
Use the following code to programmatically access the ComboBox component's drop-down list and override the delay:
var foo = myComboBox.dropdown;
Accessing the pop-up list may cause a pause in the application. This may occur when the user first interacts with the combo box, or when the above code runs.
The following table lists methods of the ComboBox class.
|
Method |
Description |
|---|---|
|
Adds an item to the end of the list. |
|
|
Adds an item to the end of the list at the specified index. |
|
|
Closes the drop-down list. |
|
|
Returns the item at the specified index. |
|
|
Opens the drop-down list. |
|
|
Removes all items in the list. |
|
|
Removes an item from the list at the specified location. |
|
|
Replaces the content of the item at the specified index. |
|
|
Sorts the list using a compare function. |
|
|
Sorts the list using a field of each item. |
The following table lists the methods the ComboBox class inherits from the UIObject class. When calling these methods from the ComboBox object, use the form comboBoxInstance.methodName.
|
Method |
Description |
|---|---|
|
Creates an object on the specified class. |
|
|
Creates a subobject on an object. |
|
|
Destroys a component instance. |
|
|
Calls a function when parameters have been set in the Property and Component inspectors. |
|
|
Gets the style property from the style declaration or object. |
|
|
Marks the object so it is redrawn on the next frame interval. |
|
|
Moves the object to the requested position. |
|
|
Forces validation of the object so it is drawn in the current frame. |
|
|
Resizes the object to the requested size. |
|
|
Sets a skin in the object. |
|
|
Sets the style property on the style declaration or object. |
The following table lists the methods the ComboBox class inherits from the UIComponent class. When calling these methods from the ComboBox object, use the form comboBoxInstance.methodName.
|
Method |
Description |
|---|---|
|
Returns a reference to the object that has focus. |
|
|
Sets focus to the component instance. |
The following table lists properties of the ComboBox class.
|
Property |
Description |
|---|---|
|
The data model for the items in the list. |
|
|
Returns a reference to the List component contained by the combo box. |
|
|
The width of the drop-down list, in pixels. |
|
|
Indicates whether a combo box is editable. |
|
|
Indicates which data field to use as the label for the drop-down list. |
|
|
Specifies a function to compute the label field for the drop-down list. |
|
|
Read-only; the length of the drop-down list. |
|
|
The set of characters that a user can enter in the text field of a combo box. |
|
|
The maximum number of list items to display at one time. |
|
|
The index of the selected item in the drop-down list. |
|
|
The value of the selected item in the drop-down list. |
|
|
The string of text in the text box. |
|
|
A reference to the TextInput component in the combo box. |
|
|
The value of the text box (editable) or drop-down list (static). |
The following table lists the properties the ComboBox class inherits from the UIObject class. When accessing these properties from the ComboBox object, use the form comboBoxInstance.propertyName.
|
Property |
Description |
|---|---|
|
Read-only; the position of the bottom edge of the object, relative to the bottom edge of its parent. |
|
|
Read-only; the height of the object, in pixels. |
|
|
Read-only; the left edge of the object, in pixels. |
|
|
Read-only.The position of the right edge of the object, relative to the right edge of its parent. |
|
|
A number indicating the scaling factor in the x direction of the object, relative to its parent. |
|
|
A number indicating the scaling factor in the y direction of the object, relative to its parent. |
|
|
Read-only; the position of the top edge of the object, relative to its parent. |
|
|
A Boolean value indicating whether the object is visible ( |
|
|
Read-only; the width of the object, in pixels. |
|
|
Read-only; the left edge of the object, in pixels. |
|
|
Read-only; the top edge of the object, in pixels. |
The following table lists the properties the ComboBox class inherits from the UIComponent class. When accessing these properties from the ComboBox object, use the form comboBoxInstance.propertyName.
|
Property |
Description |
|---|---|
|
Indicates whether the component can receive focus and input. |
|
|
A number indicating the tab order for a component in a document. |
The following table lists events of the ComboBox class.
|
Event |
Description |
|---|---|
|
Broadcast when the value of the combo box changes as a result of user interaction. |
|
|
Broadcast when the list of the combo box begins to retract. |
|
|
Broadcast when the Enter key is pressed. |
|
|
Broadcast when the pointer rolls off a pop-up list item. |
|
|
Broadcast when a drop-down list item is rolled over. |
|
|
Broadcast when the drop-down list begins to open. |
|
|
Broadcast when the drop-down list is scrolled. |
The following table lists the events the ComboBox class inherits from the UIObject class.
|
Event |
Description |
|---|---|
|
Broadcast when an object is about to draw its graphics. |
|
|
Broadcast when an object's state changes from visible to invisible. |
|
|
Broadcast when subobjects are being created. |
|
|
Broadcast when the object has moved. |
|
|
Broadcast when an object has been resized. |
|
|
Broadcast when an object's state changes from invisible to visible. |
|
|
Broadcast when the subobjects are being unloaded. |
The following table lists the events the ComboBox class inherits from the UIComponent class.
|
Event |
Description |
|---|---|
|
Broadcast when an object receives focus. |
|
|
Broadcast when an object loses focus. |
|
|
Broadcast when a key is pressed. |
|
|
Broadcast when a key is released. |
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00003169.html
Comments
diskofish said on Dec 2, 2005 at 2:30 PM : No screen name said on Mar 14, 2006 at 1:55 PM : JohnKirk said on Nov 17, 2006 at 12:01 PM : Atlahua said on Feb 8, 2007 at 12:26 PM : spor1 said on Feb 15, 2007 at 6:36 PM : Unkulunkulu said on Mar 7, 2007 at 3:33 AM : mcarey said on May 10, 2007 at 1:23 PM : bcraigie said on May 13, 2007 at 4:37 AM : badchoosed said on May 25, 2007 at 6:30 AM :