Sending and loading variables to and from a remote source 183
The server receives the XML, generates an XML response, and sends it back to the SWF file. If
the password is accepted, the server responds with the following:
<LOGINREPLY STATUS="OK" SESSION="rnr6f7vkj2oe14m7jkkycilb" />
This XML includes a SESSION attribute that contains a unique, randomly generated session ID,
which will be used in all communications between the client and server for the rest of the session.
If the password is rejected, the server responds with the following message:
<LOGINREPLY STATUS="FAILED" />
The LOGINREPLY XML node must load into a blank XML object in the SWF file. The following
statement creates the XML object
loginreplyXML to receive the XML node:
// B. Construct an XML object to hold the server's reply
loginReplyXML = new XML();
loginReplyXML.onLoad = onLoginReply;
The second statement assigns the onLoginReply() function to the
loginReplyXML.onLoad handler.
The
LOGINREPLY XML element arrives asynchronously, much like the data from a
loadVariables() function, and loads into the loginReplyXML object. When the data arrives,
the
onLoad handler of the loginReplyXML object is called. You must define the onLoginReply()
function and assign it to the
loginReplyXML.onLoad handler so that it can process the
LOGINREPLY element. You must also assign the onLoginReply() function to the frame that
contains the Submit button.