As3 Xml Text Review
Author: John Triggerman
Moving from ActionScript 2 to ActionScript 3 forces us developers to change some of the habits we have been practicing for quite some
Actionscript 3 actually contains two XML related classes, XML and XMLDocument. From a high level you can look at it like this: XML is
XML that is parsed using E4X (new to AS3 XML Text).
E4X is essentially a whole new language which is part of the AS3 grammar, just as regular expressions have their own completely
different language but exist within ActionScript 3.0. And being so new, there really isn't a whole lot of documentation out there. This is
further complicated by the fact that since E4X seems simple enough at first glance to explain in a few lines, a lot of documentation stops
Integrating AS3 and XML
The question that begs to be answered is why use AS3 XML Text. Flash 5 was extended to allow XML to be used as an external data
source. This gives you as a designer a great edge. XML takes care of the content and Flash manages the presentation. With this
combination you can create a template SWF file that is populated by an external XML document. Why is this good? The end result is that
you only need to update the XML document to change the content of the movie. No need to open the Flash movie.
Flash MX uses much the same objects and methods to control XML files. So what is the difference between 5 and MX? You will find that
the current Flash 6 Player (version 6, 0, 65, 0) is more stable and can handle more XML documents simultaneously. Flash 5 had a
challenge in that any one movie could only handle approximately 3 XML files. If you relied heavily on XML as a data format then you were
in big problems. The latest Flash Player handles more XML files and is more efficient in parsing the ActionScript used to present the
XML in your document.
The XMLDocument class represents the legacy XML object that was present in ActionScript 2.0. It was renamed in ActionScript 3.0 to
XMLDocument to avoid name conflicts with the new AS3 XML