This content has been marked as final. Show 3 replies
Try to use callLater:
private function SetSelect(newIndex):void
dg.selectedIndex = newIndex;
Maybe it can work
Thanks, that did work.
But I don't understand why its an issue. Can anyone explain? Everything in my code was working; up unti I set the selection. Placing a hardcoded int value on the set selection worked. I know that newIndex was valid. I traced out in that code section.
It would make sense if i had removed items from the dataProvider. In that case the items would be removed from the datagrid - but the screen representation not updated until the next screen redraw (frame). But neither the length of the source ArrayList or Datagrid changed.
...or am I just overlooking the inner workings of ArrayCollection.setItemAt()?
I don't know Flash development, but i do know that functions and data operations run in one frame then the UI is updated in the next. So the way you were doing it, the Selected index might have been getting set, but the UI was not updating.
callLater is the solution.