このコードで ArrayCollection 内の 2 つの項目を交換しようとしています。
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();
}
コードをデバッグすると、curItem と swapItem が正しいオブジェクトであることがわかりますが、最初に setItemAt を実行すると、必要なオブジェクトだけでなく、不要なオブジェクトも置き換えられます。ここで何が起こっているのですか?