NetConnection.connect( )

NetConnection.connect( ) MethodFlash 6

defines the URL used in a Flash Remoting connection



A URL of the Flash Remoting gateway that you wish to connect to. The URL can be prepended with an http:// or https:// protocol, but can also be used without any protocol, which defaults to http://.


true if the protocol is valid (http:// or https://), and false otherwise.


The connect( ) method is used to connect to a Flash Remoting gateway. Using the connect( ) method does not require the inclusion of the file. The word connect is something of a misnomer; at no time during this call does the NetConnection object connect to the remote server. The actual connection takes place when a service function call is made.


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

// Create the connection
var my_conn = new NetConnection( );
// Attach a URL for the gateway

In most cases, you will not use this method directly but instead use the createGatewayConnection( ) method, which instantiates a NetConnection object and connects to it as well.

See Also

NetConnection.ReplaceGatewayUrl( ), NetServices.createGatewayConnection( ), NetServices.setDefaultGateway( ); Chapter 4

    Part III: Advanced Flash Remoting