The onLoginReply() function is defined in the first (Web site hosting)

The onLoginReply() function is defined in the first frame of the SWF file. (To understand this script, read the commented lines.) function onLoginReply() { // Get the first XML element var e = this.firstChild; // If the first XML element is a LOGINREPLY element with // status OK, go to the portfolio screen. Otherwise, // go to the login failure screen and let the user try again. if (e.nodeName == “LOGINREPLY” && e.attributes.status == “OK”) { // Save the session ID for future communications with server sessionID = e.attributes.session; // Go to the portfolio viewing screen gotoAndStop(”portfolioView”); } else { // Login failed! Go to the login failure screen. gotoAndStop(”loginFailed”); } } The first line of this function, var e = this.firstChild, uses the keyword this to refer to the XML object loginReplyXML that has just been loaded with XML from the server. You can use this because onLoginReply() has been invoked as loginReplyXML.onLoad, so even though onLoginReply() appears to be a normal function, it actually behaves as a method of loginReplyXML. To send the user name and password as XML to the server and to load an XML response back into the SWF file, you can use the sendAndLoad() method, as shown here: // C. Send the LOGIN element to the server, // place the reply in loginReplyXML loginXML.sendAndLoad(”https://www.imexstocks.com/main.cgi”, loginReplyXML); Note: This design is only an example, and Macromedia can make no claims about the level of security it provides. If you are implementing a secure password-protected system, make sure you have a good understanding of network security. For more information, see Integrating XML and Flash in a Web Application at www.macromedia.com/support/flash/interactivity/xml/ and the XML class entry in Chapter 12, ActionScript Dictionary, on page 205. Using the XMLSocket class ActionScript provides a built-in XMLSocket class that allows you to open a continuous connection with a server. A socket connection allows the server to publish (or push ) information to the client as soon as that information is available. Without a continuous connection, the server must wait for an HTTP request. This open connection removes latency issues and is commonly used for real-time applications such as chats. The data is sent over the socket connection as one string and should be in XML format. You can use the XML class to structure the data. To create a socket connection, you must create a server-side application to wait for the socket connection request and send a response to the SWF file. This type of server-side application can be written in a programming language such as Java. 184 Chapter 10: Working with External Data
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.