Connect a Database with Macromedia Flash Remoting MX Using SSAS


The server-side ActionScript (SSAS) in Listing E.12 connects to a Flash Remoting MX service to perform a simple user login authentication. The service is defined when the application starts. A Service method is called and handled when the client connects. Remember, Flash Remoting MX is nonpersistent. A connection is established each time a service method is invoked.

Listing E.12 Server-Side ActionScript for Connecting a Database with Flash Remoting MX
 // Load the NetServices Class Libraries load("netservices.asc"); // When the application Starts, setup the non-persistent Flash Remoting server application.onAppStart = function() {       trace("Application was loaded, Cap'n");       NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway");       var gatewayConnection = NetServices.createGatewayConnection();       //  instantiate the service into a local variable       var cf_service = gatewayConnection.getService ("myFlashComService.login_service", graphics/ccc.gif this); }; application.onConnect = function(clientObject, username, password) {       // call the server function, authenticateUser, passing the username and password       var callTheServer = cf_service.authenticateUser(username, password);       // handle the server response       this.authenticateUser_Result = function(result_rs) {             trace("The Server Responded  > "+ result_rs.getLength());             trace("The firstName value of row 0  > "+ result_rs.items[0].firstName);             };       // handle any server errors       this.authenticateUser_Status = function(status) {             trace("Returned FAILED From the Server");       }; }; 


Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net