03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ootNode.appendChild(middle);<br />

rootNode.appendChild(youngest);<br />

// create an array <strong>and</strong> use rootNode to populate it<br />

var firstArray:Array = doc.childNodes;<br />

trace (firstArray);<br />

// output: <br />

// create another array <strong>and</strong> use the child nodes to populate it<br />

var secondArray:Array = rootNode.childNodes;<br />

trace(secondArray);<br />

// output: ,,<br />

See also<br />

nodeType (XMLNode.nodeType property), appendChild (XMLNode.appendChild<br />

method), insertBefore (XMLNode.insertBefore method), removeNode<br />

(XMLNode.removeNode method)<br />

cloneNode (XMLNode.cloneNode method)<br />

public cloneNode(deep:Boolean) : XMLNode<br />

Constructs <strong>and</strong> returns a new XML node of the same type, name, value, <strong>and</strong> attributes as the<br />

specified XML object. If deep is set to true, all child nodes are recursively cloned, resulting in<br />

an exact copy of the original object's document tree.<br />

The clone of the node that is returned is no longer associated with the tree of the cloned item.<br />

Consequently, nextSibling, parentNode, <strong>and</strong> previousSibling all have a value of null. If<br />

the deep parameter is set to false, or the my_xml node has no child nodes, firstChild <strong>and</strong><br />

lastChild are also null.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Parameters<br />

deep:Boolean - A Boolean value; if set to true, the children of the specified XML object will<br />

be recursively cloned.<br />

Returns<br />

XMLNode - An XMLNode Object.<br />

Example<br />

The following example shows how to use the XML.cloneNode() method to create a copy of a<br />

node:<br />

// create a new XML document<br />

1340 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!