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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

status (XML.status property)<br />

public status : Number<br />

Automatically sets <strong>and</strong> returns a numeric value that indicates whether an XML document was<br />

successfully parsed into an XML object. The following are the numeric status codes, with<br />

descriptions:<br />

■ 0 No error; parse was completed successfully.<br />

■ -2 A CDATA section was not properly terminated.<br />

■ -3 The XML declaration was not properly terminated.<br />

■ -4 The DOCTYPE declaration was not properly terminated.<br />

■ -5 A comment was not properly terminated.<br />

■ -6 An XML element was malformed.<br />

■ -7 Out of memory.<br />

■ -8 An attribute value was not properly terminated.<br />

■ -9 A start-tag was not matched with an end-tag.<br />

■ -10 An end-tag was encountered without a matching start-tag.<br />

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

Example<br />

The following example loads an XML packet into a SWF file. A status message displays,<br />

depending on whether the XML loads <strong>and</strong> parses successfully. Add the following <strong>ActionScript</strong><br />

to your FLA or AS file:<br />

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

my_xml.onLoad = function(success:Boolean) {<br />

if (success) {<br />

if (my_xml.status == 0) {<br />

trace("XML was loaded <strong>and</strong> parsed successfully");<br />

} else {<br />

trace("XML was loaded successfully, but was unable to be parsed.");<br />

}<br />

var errorMessage:String;<br />

switch (my_xml.status) {<br />

case 0 :<br />

errorMessage = "No error; parse was completed successfully.";<br />

break;<br />

case -2 :<br />

errorMessage = "A CDATA section was not properly terminated.";<br />

break;<br />

case -3 :<br />

XML 1331

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

Saved successfully!

Ooh no, something went wrong!