F > FComboBox (component) |  |

FComboBox (component)

FComboBox, component

The ComboBox component in the Flash authoring environment provides drag-and-drop functionality for adding scrollable single-selection drop-down lists to Flash documents; it also provides a user interface for setting basic parameters. The methods of the FComboBox component allow you to control combo boxes at runtime: you can create combo boxes, control combo boxes created in authoring, set or override basic parameters, and set additional runtime options. You do not need to use a constructor to access the methods of components.

The ComboBox component creates both static and editable combo boxes. A static combo box is a scrollable drop-down list that allows users to select items. An editable combo box is a scrollable drop-down list with a text field at the top. You can let users enter text in the text field to make the combo box scroll to the desired item, or you can use the text field to set displayed text at runtime.

Both the static and editable versions of the ComboBox component list items from top to bottom using a zero-based indexing system. If the number of items in the combo box list creates a drop-down list that exceeds the available space below the component, the list opens upward instead of dropping down.

Component methods do not perform error checking for type, as do other native ActionScript objects and actions; therefore, it is recommended that you validate parameters before passing them to methods.

The ComboBox component is supported by Flash Player 6 and later versions of the Flash Player.

For information on using the ComboBox component, setting parameters during authoring, and changing the color and appearance of components, see Customizing component colors and text and Customizing component skins in the Using Components chapter of Using Flash.

Method summary for the FComboBox component

Method | Description
--- | ---
`FComboBox.addItem` | Adds a new item to the end of the combo box list.
`FComboBox.addItemAt` | Adds a new item to the combo box list at the specified index.
`FComboBox.getEnabled` | Returns `true` if the combo box is enabled, `false` if it is disabled.
`FComboBox.getItemAt` | Returns the item at the specified index as an object with the properties `label` and `data`.
`FComboBox.getLength` | Returns the number of items listed in the combo box.
`FComboBox.getRowCount` | Returns the number of rows visible in the combo box.
`FComboBox.getScrollPosition` | Returns the index of the item at the top of the combo box.
`FComboBox.getSelectedIndex` | Returns the index of the currently selected item.
`FComboBox.getSelectedItem` | Returns the currently selected item as an object with the properties `label` and `data`.
`FComboBox.getValue` | Returns the text in the input field for editable combo boxes; returns the label or data of the selected item for static combo boxes.
`FComboBox.registerSkinElement` | Registers a skin element to a property.
`FComboBox.removeAll` | Removes all items from the combo box.
`FComboBox.removeItemAt` | Removes the item at the specified index.
`FComboBox.replaceItemAt` | Replaces the label and data of an item at the specified index.
`FComboBox.setChangeHandler` | Assigns a function to call each time an item is selected or the user enters text in the text field.
`FComboBox.setDataProvider` | Registers an outside object to the component as a data source.
`FComboBox.setEditable` | Determines whether the combo box is editable (`true`) or static (`false`).
`FComboBox.setEnabled` | Specifies whether the combo box is enabled (`true`) or disabled (`false`).
`FComboBox.setItemSymbol` | Registers a symbol linkage ID to use for displaying list items in the combo box.
`FComboBox.setRowCount` | Determines the number of items displayed in the combo box without a scroll bar.
`FComboBox.setSelectedIndex` | Selects the item at the specified index.
`FComboBox.setSize` | Sets the pixel width of the combo box.
`FComboBox.setStyleProperty` | Sets a single style property for an instance of a component.
`FComboBox.setValue` | Specifies the text displayed in the text field at the top of an editable combo box.
`FComboBox.sortItemsBy` | Sorts the items in the list box alphabetically or numerically by label or by data.