NetConnection.clone( )

NetConnection.clone( ) MethodFlash 6

duplicates a connection object, without current headers
myNetConnectionObject.clone( )

Returns

A new NetConnection object with the same URL as the original NetConnection object, but without the headers of that object.

Description

The clone( ) method is used when you need a new connection to the remote server that does not contain the headers of your existing connection, such as to call a method using a new authentication scheme.

Example

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

// NetServices.as is necessary to use clone( )
#include "NetServices.as"
// Set the URL for both connections
NetServices.setDefaultGatewayUrl("http://127.0.0.1/flashservices/gateway");
// Create the original connection
var my_conn = NetServices.createGatewayConnection( );
// Set the credentials header for the first connection
my_conn.setCredentials('admin', '1234');
// Create the cloned connection without the headers (no credentials)
var my_cloneConnection = my_conn.clone( );

See Also

NetServices.createGatewayConnection( ), NetServices.setCredentials( ); Chapter 4



    Part III: Advanced Flash Remoting