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

Create successful ePaper yourself

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

When sendAndLoad() is executed, the XML object property loaded is set to false. When<br />

the XML data finishes downloading, the loaded property is set to true if the data<br />

successfully loaded, <strong>and</strong> the onLoad event h<strong>and</strong>ler is invoked. The XML data is not parsed<br />

until it is completely downloaded. If the XML object previously contained any XML trees,<br />

they are discarded.<br />

Parameters<br />

url:String - A string; the destination URL for the specified XML object. If the SWF file<br />

issuing this call is running in a web browser, url must be in the same domain as the SWF file;<br />

for details, see the Description section.<br />

resultXML:XML - A target XML object created with the XML constructor method that will<br />

receive the return information from the server.<br />

Example<br />

The following example includes ActionScript for a simple e-commerce storefront application.<br />

The XML.sendAndLoad() method transmits an XML element that contains the user's name<br />

<strong>and</strong> password, <strong>and</strong> uses an onLoad h<strong>and</strong>ler to process the reply from the server.<br />

var login_str:String = "";<br />

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

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

myLoginReply_xml.ignoreWhite = true;<br />

myLoginReply_xml.onLoad = myOnLoad;<br />

my_xml.sendAndLoad("http://www.flash-mx.com/mm/login_xml.cfm",<br />

myLoginReply_xml);<br />

function myOnLoad(success:Boolean) {<br />

if (success) {<br />

if ((myLoginReply_xml.firstChild.nodeName == "packet") &&<br />

(myLoginReply_xml.firstChild.attributes.success == "true")) {<br />

gotoAndStop("loggedIn");<br />

} else {<br />

gotoAndStop("loginFailed");<br />

}<br />

} else {<br />

gotoAndStop("connectionFailed");<br />

}<br />

}<br />

See also<br />

send (XML.send method), load (XML.load method), loaded (XML.loaded property),<br />

onLoad (XML.onLoad h<strong>and</strong>ler)<br />

692 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!