XML.onLoad() 767
XML.onLoad()
Availability
Flash Player 5.
Usage
my_xml.onLoad = function (success) {
//your statements here
}
Parameters
success
A Boolean value indicating whether the XML object was successfully loaded with a
XML.load() or XML.sendAndLoad() operation.
Returns
Nothing.
Description
Event handler; invoked by Flash Player when an XML document is received from the server. If the
XML document is received successfully, the
success parameter is true. If the document was not
received, or if an error occurred in receiving the response from the server, the
success parameter
is
false. The default implementation of this method is not active. To override the default
implementation, you must assign a function containing your own actions.
Example
The following example creates a simple SWF file for a simple e-commerce storefront application.
The
sendAndLoad() method transmits an XML element containing the user’s name and
password, and installs an
onLoad handler to handle the reply from the server.
function myOnLoad(success) {
if (success) {
if (e.firstChild.nodeName == "LOGINREPLY_xml" &&
e.firstChild.attributes.status == "OK") {
gotoAndPlay("loggedIn")
} else {
gotoAndStop("loginFailed")
}
} else {
gotoAndStop("connectionFailed")
}
}
var myLoginReply_xml = new XML();
myLoginReply_xml.onLoad = myOnLoad;
my_xml.sendAndLoad("http://www.samplestore.com/login.cgi",
myLoginReply_xml);
See also
function
, XML.load(), XML.sendAndLoad()