While I'm having no problems parsing incoming XML, I can't seem to construct valid outgoing xml. This is my code:
myXML =
<INFO>
<imgname>testimage.jpg</imgname>
<totalCols>{totalCols}</totalCols>
</INFO>;
//The XML up to this point traces the desired output, it's when I try to append with the for loop that problems arise:
for (var i:Number = 0; i<totalCols; i++)
{
var tags:XML =
<tags>
<tagx> {tagDisplay[i].x} </tagx>
<tagy> {tagDisplay[i].y} </tagy>
<tagtext> {tagDisplay[i].tagTxt.text} </tagtext>
</tags>;
myXML.appendChild(tags);
}
The desired output I want is:
<INFO>
<imgname>testimage.jpg</imgname>
<totalCols>7</totalCols>
//for loop kicks in here:
<tags>
<tagx>100</tagx>
<tagy>100</tagy>
<tagtext>tag1</tagtext>
</tags>
<tags>
<tagx>120</tagx>
<tagy>120</tagy>
<tagtext>tag2</tagtext>
</tags>
...etc for the total number in the for loop.
</INFO>
Really simple I know, but my code just doesn't seem to work with the for loop included! Any advice much appreciated.