// <middle />
// <middle />
// <youngest />
// </rootNode>
// create a copy of rootNode using cloneNode() to demonstrate a deep copy
var rootClone:XMLNode = rootNode.cloneNode(true);
// insert the clone, which contains all child nodes, to rootNode
rootNode.appendChild(rootClone);
trace(rootNode);
// output (with line breaks added):
// <rootNode>
// <oldest />
// <middle />
// <middle />
// <youngest />
// <rootNode>
// <oldest />
// <middle />
// <middle />
// <youngest />
// </rootNode>
// </rootNode>
firstChild (XMLNode.firstChild property)
public firstChild : XMLNode [read-only]
Evaluates the specified XML object and references the first child in the parent node's child
list. This property is
if the node does not have children. This property is
if
null
undefined
the node is a text node. This is a read-only property and cannot be used to manipulate child
nodes; use the
,
, and
methods to
appendChild()
insertBefore()
removeNode()
manipulate child nodes.
Availability: ActionScript 1.0; Flash Player 5
Example
The following example shows how to use
to loop through a node's child
XML.firstChild
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
1320
ActionScript classes
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?
Questions and answers