ComboBox.removeItemAt()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

comboBoxInstance.removeItemAt(index)

Parameters

index A number that indicates the position of the item to remove. The index is zero-based.

Returns

An object; the removed item (undefined if no item exists).

Description

Method; removes the item at the specified index position. The list indices after the index indicated by the index parameter collapse by one. This is a method of the List component that is available from an instance of the ComboBox component.

Example

With a ComboBox instance my_cb on the Stage, and a Button component instance clear_button on the Stage, the following ActionScript positions the combo box and button beside each other. When you click the combo box, you'll see a list of two items. When you click the button, it clears the combo box's second item (at index position 1, because the value is zero-based):

my_cb.move(10, 10);
clear_button.move(120, 10);

// Create dataprovider.
var myDP_array:Array = new Array();
myDP_array.push({data:1, label:"First Item"});
myDP_array.push({data:2, label:"Second Item"});

my_cb.dataProvider = myDP_array;

// Define event listener object.
var clearListener:Object = new Object();
clearListener.click = function(evt_obj:Object){
 my_cb.removeItemAt(1);
}

// Add Listener.
clear_button.addEventListener("click", clearListener);

See also

ComboBox.removeAll(), ComboBox.replaceItemAt()