I am trying to swap two items in an ArrayCollection with this code.
private function swapCollectionElements(collection:ArrayCollection, fromIndex:uint, toIndex:uint) : void
{
var curItem:Object = collection.getItemAt(fromIndex);
var swapItem:Object = collection.getItemAt(toIndex);
collection.setItemAt(curItem, toIndex);
collection.setItemAt(swapItem, fromIndex);
collection.refresh();
}
When debugging the code I can see that curItem and swapItem are the correct objects, but when I do my first setItemAt, it replaces the one I wanted but also one that I didnt want. Any ideas what is going on here?