Sequence of Events in Flash
To access a remote service from Flash, your movie must initiate a connection using the NetServices.createGatewayConnection( ) method, which returns a NetConnection object through whose properties, methods, and events you’ll manage the connection. You need to know the gateway URL for your Flash Remoting server in order to make a connection. The connection is defined one time for ColdFusion and J2EE servers, even if your movie accesses multiple services via the gateway. However, each ASP.NET service requires its own call to createGatewayConnection( ). In either case, each NetConnection object persists for the entire session. Note that when you create this connection object no call has been made to the server yet.
You’ll call methods of the NetConnection object to manage the connection and access the remote service. The two NetConnection methods used most frequently in Flash Remoting applications are setCredentials( ) and getService( ). The setCredentials( ) method is used to authenticate a user.
Tip
As of this writing, setCredentials( ) is available for ColdFusion MX and JRun 4 only. It is covered in Chapter 5.
The getService( ) method sets up the call to a remote service by creating a service object, which contains the required information for Flash Remoting to make subsequent calls to methods of that remote service. The getService( ) method’s parameters are the same when using any of the service types shown previously in Table 2-8; the service is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access