var xml:XML = ; var index:uint = 0; xml.@index = index; xml..*.((parent().children()[childIndex()].@index = ++index)); trace(xml.toXMLString());