Top Level

Class NetConnection

Object


public dynamic class NetConnection
extends Object

Player version: Flash Player 7

The NetConnection class provides the means to play back streaming FLV files from a local drive or HTTP address.

Note: This class is also supported in Flash Player 6 when used with Flash Communication Server. For more information, see your Flash Communication Server documentation.




Property Summary

Properties inherited from class Object
__proto__, __resolve, constructor, prototype


Constructor Summary
NetConnection()
Creates a NetConnection object that you can use in conjunction with a NetStream object to play back local streaming video (FLV) files.


Method Summary
connect(targetURI:String) : Boolean
Opens a local connection through which you can play back video (FLV) files from an HTTP address or from the local file system.

Methods inherited from class Object
addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch


Constructor Detail

NetConnection Constructor

public NetConnection()

Player version: Flash Player 7 — Note: This class is also supported in Flash Player 6 when used with Flash Communication Server. For more information, see your Flash Communication Server documentation.

Creates a NetConnection object that you can use in conjunction with a NetStream object to play back local streaming video (FLV) files. After creating the NetConnection object, use NetConnection.connect() to make the actual connection.

Playing external FLV files provides several advantages over embedding video in a Flash document, such as better performance and memory management, and independent video and Flash frame rates. The NetConnection class provides the means to play back streaming FLV files from a local drive or HTTP address.

Example
See the example for NetConnection.connect().

See also
NetConnection.connect(), Video.attachVideo(), NetStream class


Method Detail

connect Method

public connect(targetURI:String) : Boolean

Player version: Flash Player 7 — Note: This method is also supported in Flash Player 6 when used with Flash Communication Server. For more information, see the Flash Communication Server documentation.

Opens a local connection through which you can play back video (FLV) files from an HTTP address or from the local file system.

When using this method, consider the Flash Player security model and the following security considerations:

For more information, see the following:

Parameters
targetURI:String — For this parameter, you must pass null.

Returns
Boolean — If false, the connection failed and is not usable. If true, the connection has not failed at the time the connect() method is called, but this does not guarantee success.

Example
The following example opens a connection to play the video2.flv file. Select New Video from the Library panel's options menu to create a new video object, and give it the instance name my_video.
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("video2.flv");

See also
NetStream class