The NetConnection object maintains a two-way connection between the Flash player and the Flash Communication Server. If used on the server, it establishes a two-way connection between two Flash Communication Servers. The NetConnection object is the transport that handles streams and SharedObjects. ActionScript objects and streams are transferred between client and server or server and server using the Real-Time Messaging protocol (RTMP).
To enable Code Hints and Code Completion in the Flash MX ActionScript Editor, use the suffix _nc in the name of the NetConnection variable.
Invokes a method defined in SSAS on the Communication Server. The method must be declared on the server within the Client object instance.
|remoteMethod||The name and path (if defined) of the remote method.|
|resultObject||The object that handles properties returned to Flash by the server. The result object should have two methods (onStatus and onResult). Please see Appendix E,"Useful ActionScript Templates Quick Reference," to learn more about creating a resultObject handler.|
|p1, ... ,pN||Optional parameters required by the custom client method.|
Disconnects the client from the server, cleaning up all stream and SharedObject connections.
Requests a connection to a Flash Communication Server. This invokes the Application.onConnect handler and accepts or rejects a connection based on the custom parameters you send through the connection method.
|targetURI||The Uniform Resource Identifier (URI) that references the Flash Communication Server, application, and instance. The URI must begin with RTMP:/. If no server is specified, it is assumed to be a local server and only a single forward slash is required.|
|p1 ... pN||Custom parameters that are handled by the application.onConnect method on the remote server.|
NetConnection.isConnected returns a Boolean value indicating an accepted or rejected connection.
NetConnection.uri returns the URI of the connection. This is a useful tool to use in the SharedObject.get() URI parameter to reference the NetConnection.
NetConnection.onStatus is invoked when the status of the NetConnection changes. The status will change with many events, most notably when the server accepts the connection. This event handles Information objects describing the level and a special event code. NetConnection Information objects are detailed in Appendix C.