User Guide

XML.insertBefore() 1031
XML.insertBefore()
Availability
Flash Player 5.
Usage
my_xml.insertBefore(childNode:XMLNode, beforeNode:XMLNode) : Void
Parameters
childNode
The XMLNode object to be inserted.
beforeNode The XMLNode object before the insertion point for the childNode.
Returns
Nothing.
Description
Method; inserts a new child node into the XML object’s child list, before the beforeNode node.
If the
beforeNode parameter is undefined or null, the node is added using the appendChild()
method. If
beforeNode is not a child of my_xml, the insertion fails.
Example
The following example is an excerpt from the XML.cloneNode() example:
// create a copy of the middle node using cloneNode()
var middle2:XMLNode = middle.cloneNode(false);
// insert the clone node into rootNode between the middle and youngest nodes
rootNode.insertBefore(middle2, youngest);
See also
XMLNode class