X-Z > XML.onLoad
XML.onLoadSyntax
myXML
.onLoad(
success
);
Arguments
success
A boolean value indicating whether the XML object was successfully loaded with a XML.load
or XML.sendAndLoad
operation.
Description
Method; invoked by the Flash Player when an XML document is received from the server. If the XML document is received successfully, the success
argument is true
. If the document was not received, or if an error occurred in receiving the response from the server, the success
argument 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.
Player
Flash 5 or later.
Example
The following example creates a simple Flash movie for a simple e-commerce storefront application. We use the sendAndLoad
method to transmit an XML element containing the user's name and password, and install an onLoad
handler to handle the reply from the server.
var myLoginReply = new XML(); myLoginReply.onLoad = myOnLoad; myXML.sendAndLoad("http://www.samplestore.com/login.cgi", myLoginReply); function myOnLoad(success) { if (success) { if (e.firstChild.nodeName == "LOGINREPLY" && e.firstChild.attributes.status == "OK") { gotoAndPlay("loggedIn") } else { gotoAndStop("loginFailed") } } else { gotoAndStop("connectionFailed") } }
See also
function XML.load XML.sendAndLoad