Client-Side Communication ActionScript > NetConnection (object) > Constructor for the NetConnection object

 

Constructor for the NetConnection object

Availability

Flash Player 6.

Flash Communication Server MX.

Usage

new NetConnection()

Parameters

None.

Returns

A NetConnection object.

Description

Constructor; creates an object that can be used to connect the Flash Player to the Flash Communication Server or to an application server. After creating the NetConnection object, use NetConnection.connect to make the actual connection.

For information on using Flash with an application server, see Using Flash Remoting.

Example

The following doConnect() function uses the NetConnection constructor to create a new connection and connect to the server.

function doConnect() {
	
	// Make a new connection object
	connection = new NetConnection();
	
	// Get the name of the server from user input
	// and assign it to a variable named myURL
	myURL=serverName;

	// Connect to the service
	connection.connect("rtmp://" + myURL + "/someApp/someInstance");
}

See also

NetConnection.connect