NetConnection.connect( )


NetConnection.connect( ) Method Flash 6

defines the URL used in a Flash Remoting connection
   myNetConnectionObject   .connect(   targetURL   ) 

Arguments

targetURL

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:// .

Returns

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

Description

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.

Example

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.

See Also

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



Flash Remoting
Flash Remoting: The Definitive Guide
ISBN: 059600401X
EAN: 2147483647
Year: 2003
Pages: 239
Authors: Tom Muck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net