flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject Re: XMLListCollection issue
Date Fri, 03 Jan 2014 21:44:02 GMT

> Let me take some of that back, I was describing a different issue. I think this might
be related to parenting issues within XMLList. It can produce very unexpected behavior. In
this case, its adding a node to the original parent. 

Thanks for all that. The code isn't adding anything to the original list , it's looping though
the nodes of a list then and adding them to a new collection.

var some:XMLListCollection = new XMLListCollection();
for each (var o:Object in  mainXML.item) { 

In this case mainXML is modified when it shouldn't be and ends up with 5 elements instead
of it's original 3. It certainly possible that when adding "o" it's parent is changed but
not sure why that would result in duplicate items in mainXML.

And this code works correctly even though it is calling addItem with the same objects.

var some:XMLListCollection = new XMLListCollection();
for  (var i:int =0; i <  mainXML.item.length; i++) { 

So why does using a loop index work, but using in doesn't?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message