F > FComboBox.addItem

 

FComboBox.addItem

Availability

Flash Player 6.

Usage

myComboBox.addItem(label [,data])

Parameters

label A text string to display in the combo box list.

data The value to associate with the list item. This parameter is optional.

Returns

Nothing.

Description

Method; adds a new item with the specified label and data to the end of the combo box list and updates the list. The data can be any Flash object, string, Boolean value, integer, object, or movie clip.

For best performance and load-time results, do not add more than 400 items in a single frame. This applies whether you are adding the items to a single combo box list or to several combo box lists.

Example

The following code adds the item Kenny with an associated value of Keen to the end of the list in the combo box teacherList.

teacherList.addItem("Kenny", Keen);

The following code adds the maximum number of items recommended in a single frame (400 items) to comboBox1:

for (i=0; i<400; i++) {
   comboBox1.addItem(i); 
}

The following code adds the maximum number of items recommended in a single frame (400 items) to listBox1 and comboBox2:

for (i=0; i<200; i++) {
   listBox1.addItem(i);
   comboBox2.addItem(i);  
}

See also

FComboBox.addItemAt, FComboBox.getItemAt, FComboBox.replaceItemAt, FComboBox.setDataProvider, FComboBox.sortItemsBy