User Guide
XML 731
Example
The following example includes ActionScript for a simple e-commerce storefront application.
The
sendAndLoad() method transmits an XML element that contains the user's name and
password, and uses an
XML.onLoad handler to process the reply from the server.
var login_str:String = "<login username=\""+username_txt.text+"\"
password=\""+password_txt.text+"\" />";
var my_xml:XML = new XML(login_str);
var myLoginReply_xml:XML = new XML();
myLoginReply_xml.ignoreWhite = true;
myLoginReply_xml.onLoad = function(success:Boolean){
if (success) {
if ((myLoginReply_xml.firstChild.nodeName == "packet") &&
(myLoginReply_xml.firstChild.attributes.success == "true")) {
gotoAndStop("loggedIn");
} else {
gotoAndStop("loginFailed");
}
} else {
gotoAndStop("connectionFailed");
}
};
my_xml.sendAndLoad("http://www.flash-mx.com/mm/login_xml.cfm",
myLoginReply_xml);
See also
load (XML.load method), sendAndLoad (XML.sendAndLoad method)
parseXML (XML.parseXML method)
public parseXML(value:String) : Void
Parses the XML text specified in the value parameter, and populates the specified XML
object with the resulting XML tree. Any existing trees in the XML object are discarded.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
value:String - A string that represents the XML text to be parsed and passed to the specified
XML object.