03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - 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.

Integer value Defined constant<br />

8 COMMENT_NODE<br />

9 DOCUMENT_NODE<br />

10 DOCUMENT_TYPE_NOD<br />

E<br />

11 DOCUMENT_FRAGMENT<br />

_NODE<br />

12 NOTATION_NODE<br />

In Flash Player, the built-in XML class only supports 1 (ELEMENT_NODE) <strong>and</strong> 3 (TEXT_NODE).<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Example<br />

The following example creates an element node <strong>and</strong> a text node, <strong>and</strong> checks the node type of<br />

each:<br />

// create an XML document<br />

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

// create an XML node using createElement()<br />

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

// place the new node into the XML tree<br />

doc.appendChild(myNode);<br />

// create an XML text node using createTextNode()<br />

var myTextNode:XMLNode = doc.createTextNode("textNode");<br />

// place the new node into the XML tree<br />

myNode.appendChild(myTextNode);<br />

trace(myNode.nodeType);<br />

trace(myTextNode.nodeType);<br />

// output:<br />

// 1<br />

// 3<br />

See also<br />

nodeValue (XMLNode.nodeValue property)<br />

1354 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!