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.

The following example creates an XML object by parsing the XML text specified in the<br />

source parameter, <strong>and</strong> populates the newly created XML object with the resulting XML<br />

document tree:<br />

var other_xml:XML = new XML("San<br />

Francisco");<br />

See also<br />

createElement (XML.createElement method), createTextNode (XML.createTextNode<br />

method)<br />

xmlDecl (XML.xmlDecl property)<br />

public xmlDecl : String<br />

A string that specifies information about a document's XML declaration. After the XML<br />

document is parsed into an XML object, this property is set to the text of the document's<br />

XML declaration. This property is set using a string representation of the XML declaration,<br />

not an XML node object. If no XML declaration is encountered during a parse operation, the<br />

property is set to undefined.XML. The XML.toString() method outputs the contents of the<br />

XML.xmlDecl property before any other text in the XML object. If the XML.xmlDecl property<br />

contains the undefined type, no XML declaration is output.<br />

Example<br />

The following example creates a text field called my_txt that has the same dimensions as the<br />

Stage. The text field displays properties of the XML packet that loads into the SWF file. The<br />

doc type declaration displays in my_txt. Add the following ActionScript to your FLA or AS<br />

file:<br />

var my_fmt:TextFormat = new TextFormat();<br />

my_fmt.font = "_typewriter";<br />

my_fmt.size = 12;<br />

my_fmt.leftMargin = 10;<br />

this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0,<br />

Stage.width, Stage.height);<br />

my_txt.border = true;<br />

my_txt.multiline = true;<br />

my_txt.wordWrap = true;<br />

my_txt.setNewTextFormat(my_fmt);<br />

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

my_xml.ignoreWhite = true;<br />

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

var endTime:Number = getTimer();<br />

XML 695

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

Saved successfully!

Ooh no, something went wrong!