Connect a Database with Macromedia Flash Remoting MX Using Flash ActionScript

The Flash ActionScript in Listing E.13 connects the Flash player directly to a Flash Remoting MX service. A Service method is called and handled similar to the SSAS operation. Remember, Flash Remoting MX is nonpersistent. A connection is established each time a service method is invoked.

Listing E.13 Flash ActionScript for Connecting a Database with Flash Remoting MX
// Include the Required Flash Remoting NetService class files
#include "NetServices.as"
#include "NetDebug.as"

// Define the connection to the Flash Remoting Server
NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway");
gatewayConnnection = NetServices.createGatewayConnection();

// Define the service to a local variable, cf_service
cf_Service = gatewayConnnection.getService("myFlashComService.login_service", this);
trace("REMOTING INITIALIZED");

// Call a Remoting Service Function
cf_service.authenticateUser("Kevin", "TIN");

// Handle the Service method, "authenticateUser" when returned from the server
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
authenticateUser_Status = function (status) {
      trace("Returned FAILED From the Server");
};


    Part I: 10 Quick Steps for Getting Started
     
    ASPTreeView.com
     
    Evaluation has АВАЩЛѕПХexpired.
    Info...