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. NetConnection MethodsNetConnection.call(remoteMethod, resultObject null [, p1, ,pN])Invokes a method defined in SSAS on the Communication Server. The method must be declared on the server within the Client object instance.
NetConnection.close()Disconnects the client from the server, cleaning up all stream and SharedObject connections. NetConnection.connect(targetURI, [, p1 pN])Requests a connection to a Flash Communication Server. This invokes the Application.onConnec t handler and accepts or rejects a connection based on the custom parameters you send through the connection method.
NetConnection PropertiesNetConnection.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 EventsNetConnection.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. |