views:

69

answers:

1

Ho,

how can I recursively analyze/modify XML in Flex / As3?

Let's say I have this XML:

        <div>
          <P ALIGN="center">
            <FONT FACE="ArialV" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="1"> </FONT>
          </P>
          <P ALIGN="center">
            <FONT FACE="ArialV" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="1">Copyright 2010555</FONT>
          </P>
        </div>

How can I find/change, let's say all 'font' tags that have 'size' attribute and multiply it by 2 (no matter where it is)?

Thanks in advance!

A: 

ActionScript has an E4X implementation that makes working with XML a breeze, checkout the docs: http://livedocs.adobe.com/flex/3/langref/XML.html

For your particular problem, do the following:

for each(var fontElement:XML in myXML..FONT) {
    fontElement.@SIZE = fontElement.@SIZE * 2;
}
Tyler Egeto