Here is my proposed fix in XMLListAdapter:: addItemAt() :

...

if (length > 0) {
  var localLength:uint = source.length();

  //Adjust all indexes by 1
  for ( var i:uint = localLength; i>index; i-- ) {
    source[i] = source[ i - 1 ];
  }
}
 
source[ index ] = item;

...

We may be able to optimize this too. For example, we could check if the 
incoming node already has a parent. If it does, then we need to do this work. 
If it does not, we could use the older method which is faster.

Mike



Reply via email to