开发者

Multiply with XML in FLEX

开发者 https://www.devze.com 2022-12-21 00:38 出处:网络
I write a code which is return the following XML which contain in a string type variable. <imageedit>

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"/>
  <开发者_Go百科;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?


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'.

0

精彩评论

暂无评论...
验证码 换一张
取 消