Mega Code Archive
Using change event to recognize that a new item was entered into the prompt, and adds it to the data provider
import spark.events.IndexChangeEvent;
// Event handler to determine if the selected item is new.
protected function myCB_changeHandler(event:IndexChangeEvent):void
{
// Determine if the index specifies a new data item.
if(myCB.selectedIndex == spark.components.ComboBox.CUSTOM_SELECTED_ITEM)
// Add the new item to the data provider.
myCB.dataProvider.addItem(myCB.selectedItem);
}
Red
Orange
Yellow
Blue
Green