Receiving information from an XML document or from an XML object from Flash is one thing. Editing that information and its structure after it’s loaded into Flash is another. It’s great that Flash can receive content via external documents but sometimes it also has to send it. And for information to be properly sent, it needs to be properly formatted, changed, altered, and replaced. Luckily, AS3 XML Tutorial provides methods for doing just that, all courtesy of the XML object. I suppose even if you don’t need to send anything anywhere, you still may need to alter XML in Flash just to facilitate the ever changing needs of your Flash movie, though, as I said before, it may be easier to extract it once and keep it in a format that’s more usable for you.
Down are the ways used to create and edit AS3 XML Tutorial. We’ll finished each one individually and observe exactly how they work. Also understand that these are available for reference in Flash help.
XML Instances parseXML(“xml text”)
XML Nodes appendChild(childNode) element’s child nodes.
insertBefore(childNode, beforeNode) within the current element’s child nodes.
Creates a new XML instance.
Sets the XML of an instance to the passed text.
Construct an element node.
Inserts a child node at the end of the current
Inserts a child node before any child specified
Duplicates a node.
Removes a node.
Determines if node has child node
It is vital to keep in mind that when working with AS3 XML Tutorial, you’re dealing with two different object types, an XML instance and XMLNodes that define the XML within that instance. Since the XML object extends or inherits from XMLNode, that means that all XML instances can also be treated as XMLNodes (if you’ll recall, an XML instance itself acts as a node to hold all other XML within the instance). So everything above specific to XMLNodes also works with XML instances, however those for XML instances are not meant to be used on XML nodes.