734
ActionScript classes
Parameters
url
:
String
- A string; the destination URL for the specified XML object. If the SWF file
issuing this call is running in a web browser,
url
must be in the same domain as the SWF file;
for details, see the Description section.
resultXML
:
XML
- A target XML object created with the XML constructor method that will
receive the return information from the server.
Example
The following example includes ActionScript for a simple e-commerce storefront application.
The
XML.sendAndLoad()
method transmits an XML element that contains the user's name
and password, and uses an
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 = myOnLoad;
my_xml.sendAndLoad("http://www.flash-mx.com/mm/login_xml.cfm",
myLoginReply_xml);
function myOnLoad(success:Boolean) {
if (success) {
if ((myLoginReply_xml.firstChild.nodeName == "packet") &&
(myLoginReply_xml.firstChild.attributes.success == "true")) {
gotoAndStop("loggedIn");
} else {
gotoAndStop("loginFailed");
}
} else {
gotoAndStop("connectionFailed");
}
}
See also
send (XML.send method)
,
load (XML.load method)
,
loaded (XML.loaded property)
,
onLoad (XML.onLoad handler)
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...