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.

add each of the child nodes as children of rootNode<br />

rootNode.appendChild(oldest);<br />

rootNode.appendChild(middle);<br />

rootNode.appendChild(youngest);<br />

// use lastChild to iterate through the child nodes of rootNode<br />

for (var aNode:XMLNode = rootNode.lastChild; aNode != null; aNode =<br />

aNode.previousSibling) {<br />

trace(aNode);<br />

}<br />

// output:<br />

// <br />

// <br />

// <br />

The following example creates a new XML packet <strong>and</strong> uses the XML.lastChild property to<br />

iterate through the child nodes of the root node:<br />

// create a new XML document<br />

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

var rootNode:XMLNode = doc.firstChild;<br />

// use lastChild to iterate through the child nodes of rootNode<br />

for (var aNode:XMLNode = rootNode.lastChild; aNode != null;<br />

aNode=aNode.previousSibling) {<br />

trace(aNode);<br />

}<br />

// output:<br />

// <br />

// <br />

// <br />

See also<br />

appendChild (XMLNode.appendChild method), insertBefore (XMLNode.insertBefore<br />

method), removeNode (XMLNode.removeNode method), hasXMLSocket<br />

(capabilities.hasXMLSocket property)<br />

nextSibling (XMLNode.nextSibling property)<br />

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

706 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!