>I will write it all up tonight if possible. I can provide example of each step 
>and what's going on.

In XMLListAdapter, addItemAt() we see this after the first addItem()

source[0] = length > 0 ? item + source[0] : item;

this effectively sets source[0] to the unchanged item... and the parent doesn't 
change. so, remember, item still has the original XMLList as a parent

So, at this point, source[0].parent() is the original XML list... not source. 
After this first item is added, the XMLListCollection has 1 item in it and the 
mainXML still has 3 items. All is well.

... the loop continues

After the second addItemAt() we get into XMLListAdapter again, however, since 
there is already an item in the list we are funneled into a different condition:

source[index - 1] += item;

So, we take source of index-1, which is the first node... and we add item to 
it... but the first node's parent is the _original_ XMLList (mainXML). 

After this line executes, the original XMLlist now has 4 items, including two 
copies of item #2.

We, of course, do this all again, and now the mainXML has 5 items including two 
copies of item #2 and two copies of item #3.

...
Now, it works in the index cases.... well cause it doesn't and it's a false 
reading:

for (var i:int=0; i < mainXML.item.length; i++)
{ some.addItem(mainXML.item[i]); }

So, the mainXML.item.length evaluates to 0. It never runs the loop and hence, 
the original XMLList is unchanged. That's because length is a function on an 
XMLList, you meant: mainXML.item.length() which shows the same problem.

Mike

Reply via email to