03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Parameters<br />

newChild:XMLNode - The XMLNode object to be inserted.<br />

insertPoint:XMLNode - The XMLNode object that will follow the newChild node after the<br />

method is invoked.<br />

Example<br />

The following inserts a new XML node between two existing nodes:<br />

var my_xml:XML = new XML("1\n3");<br />

var insertPoint:XMLNode = my_xml.lastChild;<br />

var newNode:XML = new XML("2\n");<br />

my_xml.insertBefore(newNode, insertPoint);<br />

trace(my_xml);<br />

See also<br />

hasXMLSocket (capabilities.hasXMLSocket property), cloneNode<br />

(XMLNode.cloneNode method)<br />

lastChild (XMLNode.lastChild property)<br />

public lastChild : XMLNode [read-only]<br />

An XMLNode value that references the last child in the node's child list. The XML.lastChild<br />

property is null if the node does not have children. This property cannot be used to<br />

manipulate child nodes; use the appendChild(), insertBefore(), <strong>and</strong> removeNode()<br />

methods to manipulate child nodes.<br />

Example<br />

The following example uses the XML.lastChild property to iterate through the child nodes<br />

of an XML node, beginning with the last item in the node's child list <strong>and</strong> ending with the first<br />

child of the node's child list:<br />

// create a new XML document<br />

var doc:XML = new XML();<br />

// create a root node<br />

var rootNode:XMLNode = doc.createElement("rootNode");<br />

// create three child nodes<br />

var oldest:XMLNode = doc.createElement("oldest");<br />

var middle:XMLNode = doc.createElement("middle");<br />

var youngest:XMLNode = doc.createElement("youngest");<br />

// add the rootNode as the root of the XML document tree<br />

doc.appendChild(rootNode);<br />

XMLNode 705

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!