Using XML with ActionScript 2 is always more complicated than it needed to be.
Let's fix that !

After having to create loots of small flash banners and applications, accesing XML files, I had the idea to parse the xml nodes into actionscript as arrays, that would make working with xml quite more easier for me, I then just parse the file when I need it, and then forget about it.

This class is only for AS2. I got quite surprise when AS3 include a parser to the XML who basicly works in the same way.

This code provides an easy way to load an XML file and parse the data into an easy to access array.
Every node becomes an array with the same name and all attributes become properties.

So for example, if your XML is like this:

    <Book name="Mary Poppins" />
    <Book name="Sphere" >
      This is the book description...	

Then you can, for example, access the second book with:


Download: XML2Array Class and Demo Code