User Guide
ComboBox.removeAll() 191
ComboBox.removeAll()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
comboBoxInstance.removeAll()
Parameters
None.
Returns
Nothing.
Description
Method; removes all items in the list. 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 items. When you click
the button, it clears the combo box’s items:
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.removeAll();
}
// Add Listener.
clear_button.addEventListener("click", clearListener);