Andreas
Andreas

Reputation: 1311

XML Node replacement in Actionscript 3

A couple of days ago I asked a question about how to replace and edit values in an xml file with c#. The question got a great answer. Now I wonder how to do this in Actionscript and if there is an as simple way as in c#.

The question can be found here: Advanced replace in C#

Thanks

Upvotes: 0

Views: 415

Answers (1)

Patrick
Patrick

Reputation: 15717

var xml:XML=<items>                       
  <item x="15" y="25">                          
    <item y="10" x="30"></item>                 
  </item>                                       
  <item x="5" y="60"></item>                    
  <item y="100" x="10"></item>                  
</items>;                                       

for each (var item:XML in xml..item){
  item.@x=Number(item.@x)+Number(item.@y);
}

trace(xml);

Upvotes: 1

Related Questions