EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Clonenode (Xmlnode.clonenode Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1318 ActionScript classes
Availability: ActionScript 1.0; Flash Player 5
Example
The following example shows how to use the XML.childNodes property to return an array of
child nodes:
// create a new XML document
var doc:XML = new XML();
// create a root node
var rootNode:XMLNode = doc.createElement("rootNode");
// create three child nodes
var oldest:XMLNode = doc.createElement("oldest");
var middle:XMLNode = doc.createElement("middle");
var youngest:XMLNode = doc.createElement("youngest");
// add the rootNode as the root of the XML document tree
doc.appendChild(rootNode);
// add each of the child nodes as children of rootNode
rootNode.appendChild(oldest);
rootNode.appendChild(middle);
rootNode.appendChild(youngest);
// create an array and use rootNode to populate it
var firstArray:Array = doc.childNodes;
trace (firstArray);
// output: <rootNode><oldest /><middle /><youngest /></rootNode>
// create another array and use the child nodes to populate it
var secondArray:Array = rootNode.childNodes;
trace(secondArray);
// output: <oldest />,<middle />,<youngest />
See also
nodeType (XMLNode.nodeType property), appendChild (XMLNode.appendChild
method)
, insertBefore (XMLNode.insertBefore method), removeNode
(XMLNode.removeNode method)
cloneNode (XMLNode.cloneNode method)
public cloneNode(deep:Boolean) : XMLNode
Constructs and returns a new XML node of the same type, name, value, and attributes as the
specified XML object. If
deep is set to true, all child nodes are recursively cloned, resulting in
an exact copy of the original object's document tree.

Table of Contents

Related product manuals