ActionScript 2.0 Components Language Reference |
|
|
|
| ComboBox component > ComboBox.removeItemAt() | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
comboBoxInstance.removeItemAt(index)
index A number that indicates the position of the item to remove. The index is zero-based.
An object; the removed item (undefined if no item exists).
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.
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);
ComboBox.removeAll(), ComboBox.replaceItemAt()
|
|
|
|