NetConnection.ReplaceGatewayUrl( )

NetConnection.ReplaceGatewayUrl( ) MethodFlash 6

changes the gateway URL
myNetConnectionObject.ReplaceGatewayUrl(targetURL)

Arguments

targetURL

A URL of the Flash Remoting gateway that you wish to connect to. The URL must be prepended with an http:// or https:// protocol.

Description

The ReplaceGatewayUrl( ) method is used to change the Flash Remoting gateway URL previously specified via NetConnection.connect( ), NetServices.createGatewayConnection( ), or NetServices.setDefaultGatewayUrl( ). Using the ReplaceGate-wayUrl( ) method requires the inclusion of the NetServices.as file.

Example

The following code shows the basic syntax of the ReplaceGatewayUrl( ) method:

#include "NetServices.as"
if (connected == null) {
  // Initialize the variable so this section is only called once
  connected = true;
  // Create the NetConnection object
  gatewayURL = "http://www.flash-remoting.com/flashservices/gateway";
  var my_conn = NetServices.createGatewayConnection(gatewayURL);
}

Then, at some later time:

newGatewayURL = "http://127.0.0.1/flashservices/gateway";
my_conn.ReplaceGatewayUrl(newGatewayURL);

Usage

You should not use this method directly, because it is reserved for use by the server, which can pass a ReplaceGatewayUrl header to the Flash movie.

See Also

NetConnection.close( ), NetConnection.connect( ), NetServices.createGatewayConnection( ), NetServices.setDefaultGatewayUrl( ); Chapter 4



    Part III: Advanced Flash Remoting