NetConnection


Object   |   +-NetConnection public dynamic class NetConnection extends Object

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.


Availability: ActionScript 1.0; Flash Player 7

Property summary

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property),prototype (Object.prototype property), __resolve (Object.__resolve property)


Constructor summary

Signature

Description

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

Modifiers

Signature

Description

 

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 (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method),toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)


connect (NetConnection.connect method)

public 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.

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

  • The default is to deny access between sandboxes. The website can enable access to a resource via a cross-domain policy file.

  • A website can deny access to a resource by adding server-side ActionScript application logic in Flash Communication Server.

  • For Flash Player 8, NetConnection.connect() is not allowed if the calling SWF file is in the local-with-file-system sandbox.

For more information, see the following:

  • Chapter 17, "Understanding Security," in Learning ActionScript 2.0 in Flash

  • The Flash Player 8 Security white paper at http://www.macromedia.com/go/fp8_security

  • The Flash Player 8 Security-Related API white paper at http://www.macromedia.com/go/fp8_security_apis

Availability: ActionScript 1.0; 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.

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

NetConnection constructor

public NetConnection()

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.

Availability: ActionScript 1.0; 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.

Example

See the example for NetConnection.connect().

See also

connect (NetConnection.connect method), attachVideo (Video.attachVideo method), NetStream



ActionScript 2.0 Language Reference for Macromedia Flash 8
ActionScript 2.0 Language Reference for Macromedia Flash 8
ISBN: 0321384040
EAN: 2147483647
Year: 2004
Pages: 113

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