insertBefore (XMLNode.insertBefore method)

public insertBefore(newChild:XMLNode, insertPoint:XMLNode) : Void

Inserts a newChild node into the XML object's child list, before the insertPoint node. If insertPoint is not a child of the XMLNode object, the insertion fails.

Availability: ActionScript 1.0; Flash Player 5

Parameters

newChild:XMLNode - The XMLNode object to be inserted.

insertPoint:XMLNode - The XMLNode object that will follow the newChild node after the 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)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002353.html