Xml.firstchild - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

XML.firstChild

Availability
Flash Player 5.
Usage
my_xml.firstChild:XMLNode
Description
Read-only property; evaluates the specified XML object and references the first child in the parent
node's child list. This property is
if the node is a text node. This is a read-only property and cannot be used to
undefined
manipulate child nodes; use the
to manipulate child nodes.
Example
The following example shows how to use
// 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);
// use firstChild to iterate through the child nodes of rootNode
for (var aNode:XMLNode = rootNode.firstChild; aNode != null; aNode =
aNode.nextSibling) {
trace(aNode);
}
// output:
// <oldest />
// <middle />
// <youngest />
The following example is from the XML_languagePicker FLA file in the Examples directory and
can be found in the
// loop through the strings in each language node
// adding each string as a new element in the language array
1024
Chapter 2: ActionScript Language Reference
if the node does not have children. This property is
null
appendChild()
XML.firstChild
languageXML.onLoad
,
insertBefore()
to loop through a node's child nodes:
event handler function definition:
, and
methods
removeNode()

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents