NetConnection.clone( ) Method | Flash 6 |
duplicates a connection object, without current headers |
A new NetConnection object with the same URL as the original NetConnection object, but without the headers of that object.
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.
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( );
NetServices.createGatewayConnection( ), NetServices.setCredentials( ); Chapter 4