I have a situation where the FlexJS output is different than the Flash output
of XML, but it seems to me like the Flash output is wrong. I’m not sure what
I’m missing:
Here’s the (stripped down) code:
var xml2:XML = new XML('<root
xmlns:fz="http://ns.adobe.com/mxml/2009"><a><b/></a><a
name="fred"/><a>hi<b>yeah!</b></a><a name="frank"/><c/></root>');
var list1:XMLList = xml2.a;
var aaa = list1[0];
var aab = list1[0][0][0];
var list2:XMLList = xml2.child("a");
var list3:XMLList = xml2.descendants();
list3 = list3.(attribute("name").length());
list2[list2.length()] = <c id="1"/>;
list2[0] = <bla/>;
var list4:XMLList = new XMLList();
list4[0] = <a id="1"/>;
list4[1] = <a id="2"/>;
list4[2] = <a id="3"/>;
list1 += list4
trace("after concat");
trace(xml2.toString());
In Flash the output is:
after concat
<root xmlns:fz="http://ns.adobe.com/mxml/2009">
<bla/>
<a name="fred"/>
<a>
hi
<b>yeah!</b>
</a>
<a name="frank"/>
<c id="1"/>
<c/>
</root>
In JS, the output is:
after concat
<root xmlns:fz="http://ns.adobe.com/mxml/2009">
<bla/>
<a name="fred"/>
<a>
hi
<b>yeah!</b>
</a>
<a name="frank"/>
<c/>
<c id="1"/>
<a id="1"/>
<a id="2"/>
<a id="3"/>
</root>
Ignoring the order of the “c” elements for right now (which is a bug I’m going
to fix), it seems to me that the three “a” elements that appear in the JS
output is correct. I don’t know why Flash does not append the elements to the
original XML.
Does anyone have any ideas?
Harbs