While working on reordering elements in a List, I discovered a shortcoming in the working of the List. On setting the dataProvider and selectedIndex of the list, the selectedIndex was not being updated.
private function reorder() : void
{
myList.dataProvider = _elementsArr;
myList.selectedIndex = _selectedIndex + 1;
}
My Man Friday, Google, disclosed a workaround for it.
private function reorder() : void
{
myList.dataProvider = _elementsArr;
myList.validateNow();
myList.selectedIndex = _selectedIndex + 1;
}
Calling the validateNow() after the dataProvider is set and before the selectedIndex is set does the trick.
