NetConnection.connect( ) Method | Flash 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 NetServices.as 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 my_conn.connect("http://127.0.0.1/flashservices/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.
NetConnection.ReplaceGatewayUrl( ), NetServices.createGatewayConnection( ), NetServices.setDefaultGateway( ); Chapter 4