Haschildnodes (Xmlnode.haschildnodes Method); Insertbefore (Xmlnode.insertbefore Method) - MACROMEDIA FLASHLITE2 ACTIONSCRIPT-LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

See also
appendChild (XMLNode.appendChild method)
,
method)
removeNode (XMLNode.removeNode method)

hasChildNodes (XMLNode.hasChildNodes method)

public hasChildNodes() : Boolean
Specifies whether or not the XML object has child nodes.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
-
if the specified XMLNode has one or more child nodes; otherwise
Boolean
true
Example
The following example creates a new XML packet. If the root node has child nodes, the code
loops over each child node to display the name and value of the node. Add the following
ActionScript to your FLA or AS file:
var my_xml:XML = new XML("hankrudolph");
if (my_xml.firstChild.hasChildNodes()) {
// use firstChild to iterate through the child nodes of rootNode
for (var aNode:XMLNode = my_xml.firstChild.firstChild; aNode != null;
aNode=aNode.nextSibling) {
if (aNode.nodeType == 1) {
trace(aNode.nodeName+":\t"+aNode.firstChild.nodeValue);
}
}
}
The following is displayed in the Output panel:
output:
username: hank
password: rudolph

insertBefore (XMLNode.insertBefore method)

public insertBefore(newChild:XMLNode, insertPoint:XMLNode) : Void
Inserts a
node into the XML object's child list, before the
newChild
is not a child of the XMLNode object, the insertion fails.
insertPoint
Availability: ActionScript 1.0; Flash Lite 2.0
,
insertBefore (XMLNode.insertBefore
insertPoint
.
false
node. If
XMLNode
747

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash lite 2

Table of Contents