CHAPTER 10 USING FLASH TO DISPLAY XML (Best web site)
CHAPTER 10 USING FLASH TO DISPLAY XML 301 appendChild(newChild:XMLNode) The appendChild()method adds a new child after the last child node of the current XMLNode object. You can use this method to append a node that you ve just created: oNewNode = oXML.createElement(”dvd”); oXML.childNodes[0].appendChild(oNewNode); You can also use the method to move an existing node to a new location. cloneNode(deep:Boolean) The cloneNode()method clones an existing XMLNodeobject. It copies all attributes within the node. Set the deep parameter to true to clone all child nodes recursively: oXML.oXMLNode.cloneNode(true) The method returns the cloned node without a parent. You ll need to use appendChild() or insertBefore() to locate it within the document tree. insertBefore(newChild:XMLNode, insertPoint:XMLNode) This method inserts a new XMLNode object before an existing XMLNode object: var oOldNode:XMLNode = oXML.firstChild.childNode[1]; var oNewNode:XMLNode = oXML.createElement(”dvd”); oXML.insertBefore(oNewNode, oOldNode); If insertPoint is not a child of the XMLNode object, the insert will fail. removeNode() The removeChild()method removes the specified XMLNode. It returns nothing: var nodeToRemove:XMLNode = oXML.firstChild.childNodes[2]; nodeToRemove.removeNode(); Loading and Displaying XML Content in Flash In the previous section, I covered the methods and properties that are available to you when working with XML content in Flash. These will make much more sense if I work through an example. The example file dvd2.fla shows how to load the dvd.xml file into Flash and display the details of a selected DVD in UI components. Figure 10-2 shows this movie with a selected DVD.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.