import mx.events.CollectionEventKind;
import mx.events.CollectionEvent;
import mx.collections.SortField;
import mx.collections.Sort;
import mx.collections.ArrayCollection;
private var index:Number = 0;
public function addItem():void
{
myCollection.addItem({label: myTextInput.text, data: index});
index++;
}
private function updateItem():void
{
if (myList.selectedItem != null)
myCollection.setItemAt({label: myTextInput.text, data: index}, myList.selectedIndex);
}