206
Server-Side ActionScript Language Reference
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 = "<login username=\""+username_txt.text+"\"
password=\""+password_txt.text+"\" />";
var my_xml = new XML(login_str);
var myLoginReply_xml = new XML();
myLoginReply_xml.ignoreWhite = true;
myLoginReply_xml.onLoad = function(success){
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
XML.load()
,
XML.sendAndLoad()
XML.parentNode
Availability
Flash Media Server 2.
Usage
my_xml
.parentNode
Description
Property (read-only); an XMLNode value that references the parent node of the specified
XML object or returns
null
if the node has no parent. This property cannot be used to
manipulate child nodes; use the
appendChild()
,
insertBefore()
, and
removeNode()
methods instead.