tags:

views:

26

answers:

1

I write a code which is return the following XML which contain in a string type variable.

<imageedit>
  <matrix a="0.5213903738845257" b="0" c="0" d="0.5213903738845257" tx="559.6" ty="1.0784769629138395"/>
  <cutout x="0" y="0" width="400" height="568"/>
</imageedit>

Now i want to multiply all the nodes with 3 and again store in that string type variable. how can i do this?

A: 

You can use E4X to access attributes like this:

var xml : XML = <imageedit>
  <matrix a="0.5213903738845257" b="0" c="0" d="0.5213903738845257" tx="559.6" ty="1.0784769629138395"/>
  <cutout x="0" y="0" width="400" height="568"/>
</imageedit>

xml.matrix.@a = Number(xml.matrix.@a)*3

and the same for other attributes. You can also iterate through them with 'for each'.

mico