Parameters
- The XMLNode object to be inserted.
newChild:XMLNode
- The XMLNode object that will follow the
node after the
insertPoint:XMLNode
newChild
method is invoked.
Example
The following inserts a new XML node between two existing nodes:
var my_xml:XML = new XML("<a>1</a>\n<c>3</c>");
var insertPoint:XMLNode = my_xml.lastChild;
var newNode:XML = new XML("<b>2</b>\n");
my_xml.insertBefore(newNode, insertPoint);
trace(my_xml);
See also
,
XML
cloneNode (XMLNode.cloneNode method)
lastChild (XMLNode.lastChild property)
public lastChild :
XMLNode
[read-only]
An XMLNode value that references the last child in the node's child list. The
XML.lastChild
property is
if the node does not have children. This property cannot be used to
null
manipulate child nodes; use the
,
, and
appendChild()
insertBefore()
removeNode()
methods to manipulate child nodes.
Availability: ActionScript 1.0; Flash Lite 2.0
Example
The following example uses the
property to iterate through the child nodes
XML.lastChild
of an XML node, beginning with the last item in the node's child list and ending with the first
child of the node's child list:
// 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
748
ActionScript classes
Need help?
Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?