On 16/10/2011 14:16, Kenneth Kawamoto wrote:
It's getting rather interesting :D

var xml:XML = <my_xml>
<row id="a" parent="a" />
<row id="b" parent="a" />
<row id="c" parent="a" />

<row id="d" parent="d" />
<row id="e" parent="d" />
<row id="f" parent="d" />

<row id="g" parent="e" />
<row id="h" parent="e" />
<row id="i" parent="h" />
</my_xml>;

for each (var row:XML in xml.row){
    if(row.@id != row.@parent){
        xml..row.(@id == row.@parent).appendChild(row.copy());
        delete xml.row.(@id == row.@id)[0];
    }
}

trace(xml);

Excellent Kenneth - thank you.

I managed to construct the tree, but couldn't remove the old rows. Good job.

I think that does it - no more complications!

Paul
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to