U-X > XML.onLoad

 

XML.onLoad

Availability

Flash Player 5.

Usage

myXML.onLoad(success)

Parameters

success A Boolean value indicating whether the XML object was successfully loaded with a XML.load or XML.sendAndLoad operation.

Returns

Nothing.

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 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 Flash movie 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" &&
				e.firstChild.attributes.status == "OK") {
			gotoAndPlay("loggedIn")
		} else {
			gotoAndStop("loginFailed")
		}
	} else {
		gotoAndStop("connectionFailed")
	}
}
var myLoginReply = new XML();
myLoginReply.onLoad = myOnLoad;
myXML.sendAndLoad("http://www.samplestore.com/login.cgi",
						myLoginReply);

See also

function, XML.load, XML.sendAndLoad