| Package | vegas.net |
| Class | public dynamic class NetServerConnection |
| Inheritance | NetServerConnection CoreEventDispatcher Object |
| Implements | Action, Cloneable |
Example :
import system.events.ActionEvent ;
import vegas.events.NetServerEvent ;
import vegas.net.NetServerConnection ;
import flash.events.Event ;
var status:Function = function( e:NetStatusEvent ):void
{
trace("status " + e ) ;
var info:Object = e.info ;
for (var prop:String in info)
{
trace(prop + " : " + info[prop]) ;
}
trace("----") ;
}
var accept:Function = function( e:NetServerEvent ):void
{
trace("accept " + e.info ) ;
trace("----") ;
}
var reject:Function = function( e:NetServerEvent ):void
{
trace("reject " + e.info ) ;
trace("----") ;
}
var debug:Function = function( e:Event ):void
{
trace("debug " + e) ;
}
var nc:NetServerConnection = new NetServerConnection() ;
nc.addEventListener(ActionEvent.FINISH , debug ) ;
nc.addEventListener(ActionEvent.START , debug ) ;
nc.addEventListener(NetServerEvent.ACCEPT , accept ) ;
nc.addEventListener(NetServerEvent.REJECT , reject ) ;
nc.addEventListener(NetStatusEvent.NET_STATUS , status ) ;
nc.objectEncoding = ObjectEncoding.AMF0 ;
nc.connect("rtmp://localhost/yourapplication") ; // The RTMP application server
| Property | Defined By | ||
|---|---|---|---|
![]() | channel : String [read-only]
Indicates the channel of this dispatcher if this instance is global. | CoreEventDispatcher | |
| client : Object
The default object encoding (AMF version) for NetConnection objects created in the SWF file. | NetServerConnection | ||
| connected : Boolean [read-only]
[read-only] Indicates whether Flash Player has connected to a server through a persistent RTMP connection (true) or not (false). | NetServerConnection | ||
| connectedProxyType : String [read-only]
[read-only] Indicates whether Flash Player has connected to a server through a persistent RTMP connection (true) or not (false). | NetServerConnection | ||
| connection : NetConnection [read-only]
Indicates the internal NetConnection reference of this object. | NetServerConnection | ||
| defaultObjectEncoding : uint [static]
The default object encoding (AMF version) for NetConnection objects created in the SWF file. | NetServerConnection | ||
| farID : String [read-only]
The identifier of the Flash Media Server instance to which this Flash Player or Adobe AIR instance is connected. | NetServerConnection | ||
| farNonce : String [read-only]
A value chosen substantially by Flash Media Server, unique to this connection. | NetServerConnection | ||
| finishIt : Signaler
This signal emit when the notifyFinished method is invoked. | NetServerConnection | ||
| maxPeerConnections : uint
The total number of inbound and outbound peer connections that this instance of Flash Player or Adobe AIR allows. | NetServerConnection | ||
| nearID : String [read-only]
The identifier of this Flash Player or Adobe AIR instance for this NetConnection instance. | NetServerConnection | ||
| nearNonce : String [read-only]
A value chosen substantially by this Flash Player or Adobe AIR instance, unique to this connection. | NetServerConnection | ||
| objectEncoding : uint
The ObjectEncoding class allows classes that serialize objects (such as FileStream, NetStream, NetConnection, SharedObject, and ByteArray) to work with prior versions of ActionScript. | NetServerConnection | ||
| phase : String [read-only]
The current phase of the action. | NetServerConnection | ||
| protocol : String [read-only]
Indicates the protocol used to establish the connection. | NetServerConnection | ||
| proxyType : String
Determines whether native SSL is used for RTMPS instead of HTTPS, and whether the CONNECT method of tunneling is used to connect through a proxy server. | NetServerConnection | ||
| running : Boolean [read-only]
Indicates true if the process is in progress. | NetServerConnection | ||
| startIt : Signaler
This signal emit when the notifyStarted method is invoked. | NetServerConnection | ||
| unconnectedPeerStreams : Array [read-only]
An object that holds all of the peer subscriber NetStream objects that are not associated with publishing NetStream objects. | NetServerConnection | ||
| uri : String
The URI of the application server that was passed to NetConnection.connect(), if connect was used to connect to a server. | NetServerConnection | ||
| usingTLS : Boolean [read-only]
Indicates whether a secure connection was made using native Transport Layer Security (TLS) rather than HTTPS. | NetServerConnection | ||
| Method | Defined By | ||
|---|---|---|---|
NetServerConnection(global:Boolean = false, channel:String = null)
Creates a new NetServerConnection instance. | NetServerConnection | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target. | CoreEventDispatcher | |
addHeader(operation:String, mustUnderstand:Boolean = false, param:Object = null):void
Adds a context header to the AMF packet structure. | NetServerConnection | ||
call(command:String, responder:Responder, ... rest):Boolean
Invokes a command or method on the server running Flash Media Server, or on an application server, to which the application instance is connected. | NetServerConnection | ||
clone():*
Returns the shallow copy of this object. | NetServerConnection | ||
close(noEvent:Boolean = false):Boolean
Closes the connection that was opened locally or with the server and dispatches the netStatus event with a code property of NetConnection.Connect.Closed. | NetServerConnection | ||
connect(command:String, ... arguments):void
Connect the client with this method. | NetServerConnection | ||
![]() | dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow. | CoreEventDispatcher | |
getDelay():uint
Returns timeout interval duration. | NetServerConnection | ||
![]() |
Returns the internal system.events.EventDispatcher reference. | CoreEventDispatcher | |
Returns the TimeoutPolicy value of this object. | NetServerConnection | ||
![]() | hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | CoreEventDispatcher | |
![]() | isGlobal():Boolean
Indicates if the dispatcher use a global event flow. | CoreEventDispatcher | |
![]() | isLocked():Boolean
Returns true if the object is locked. | CoreEventDispatcher | |
![]() | lock():void
Locks the object. | CoreEventDispatcher | |
notifyFinished():void
Invoked when the connection is finished. | NetServerConnection | ||
notifyStarted():void
Invoked when the connection is started. | NetServerConnection | ||
![]() | registerEventListener(type:String, listener:*, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target (Function or EventListener). | CoreEventDispatcher | |
![]() | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. | CoreEventDispatcher | |
run(... arguments):void
Runs the process of this NetServerConnection. | NetServerConnection | ||
setDelay(n:Number, useSeconds:Boolean):void
Set timeout interval duration. | NetServerConnection | ||
![]() | setEventDispatcher(dispatcher:EventDispatcher):void
Sets the internal EventDispatcher reference. | CoreEventDispatcher | |
![]() | setGlobal(flag:Boolean = false, channel:String = null):void
Sets if the instance use a global system.events.EventDispatcher to dispatch this events, if the flag value is false the instance use a local EventDispatcher. | CoreEventDispatcher | |
setLimitPolicy(policy:TimeoutPolicy):void
Use limit timeout interval. | NetServerConnection | ||
sharedEvent(event:* = null, context:* = null):void
Use this method to dispatch in FMS application an event. | NetServerConnection | ||
![]() | unlock():void
Unlocks the display. | CoreEventDispatcher | |
![]() | unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object. | CoreEventDispatcher | |
![]() | willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | CoreEventDispatcher | |
| Method | Defined By | ||
|---|---|---|---|
![]() |
Creates and returns the internal EventDispatcher reference (this method is invoked in the constructor). | CoreEventDispatcher | |
notifyNetServerEvent(type:String, status:NetServerStatus = null, info:* = null):void
Invoked when the connection is closed. | NetServerConnection | ||
notifyTimeOut():void
Invoked when the connection is timeout. | NetServerConnection | ||
setRunning(b:Boolean):void
Changes the running property value. | NetServerConnection | ||
| Constant | Defined By | ||
|---|---|---|---|
| DEFAULT_DELAY : uint = 8000 [static]
The default internal timeout delay value in milliseconds. | NetServerConnection | ||
| client | property |
client:ObjectThe default object encoding (AMF version) for NetConnection objects created in the SWF file. When an object is written to or read from binary data, the defaultObjectEncoding property indicates which Action Message Format version should be used: the ActionScript 3.0 format or the ActionScript 1.0 and ActionScript 2.0 format.
public function get client():Object public function set client(value:Object):void| connected | property |
connected:Boolean [read-only] [read-only] Indicates whether Flash Player has connected to a server through a persistent RTMP connection (true) or not (false). When connected through HTTP, this property is always false. It is always true for AMF connections to application servers.
public function get connected():Boolean| connectedProxyType | property |
connectedProxyType:String [read-only] [read-only] Indicates whether Flash Player has connected to a server through a persistent RTMP connection (true) or not (false). When connected through HTTP, this property is always false. It is always true for AMF connections to application servers.
public function get connectedProxyType():String| connection | property |
connection:NetConnection [read-only] Indicates the internal NetConnection reference of this object.
public function get connection():NetConnection| defaultObjectEncoding | property |
defaultObjectEncoding:uintThe default object encoding (AMF version) for NetConnection objects created in the SWF file. When an object is written to or read from binary data, the defaultObjectEncoding property indicates which Action Message Format version should be used: the ActionScript 3.0 format or the ActionScript 1.0 and ActionScript 2.0 format.
public static function get defaultObjectEncoding():uint public static function set defaultObjectEncoding(value:uint):void| farID | property |
farID:String [read-only] The identifier of the Flash Media Server instance to which this Flash Player or Adobe AIR instance is connected.
public function get farID():String| farNonce | property |
farNonce:String [read-only] A value chosen substantially by Flash Media Server, unique to this connection.
public function get farNonce():String| finishIt | property |
finishIt:SignalerThis signal emit when the notifyFinished method is invoked.
public function get finishIt():Signaler public function set finishIt(value:Signaler):void| maxPeerConnections | property |
maxPeerConnections:uintThe total number of inbound and outbound peer connections that this instance of Flash Player or Adobe AIR allows.
public function get maxPeerConnections():uint public function set maxPeerConnections(value:uint):void| nearID | property |
nearID:String [read-only] The identifier of this Flash Player or Adobe AIR instance for this NetConnection instance.
public function get nearID():String| nearNonce | property |
nearNonce:String [read-only] A value chosen substantially by this Flash Player or Adobe AIR instance, unique to this connection.
public function get nearNonce():String| objectEncoding | property |
objectEncoding:uintThe ObjectEncoding class allows classes that serialize objects (such as FileStream, NetStream, NetConnection, SharedObject, and ByteArray) to work with prior versions of ActionScript.
public function get objectEncoding():uint public function set objectEncoding(value:uint):void| phase | property |
phase:String [read-only] The current phase of the action.
public function get phase():StringSee also
| protocol | property |
protocol:String [read-only] Indicates the protocol used to establish the connection.
public function get protocol():String| proxyType | property |
proxyType:StringDetermines whether native SSL is used for RTMPS instead of HTTPS, and whether the CONNECT method of tunneling is used to connect through a proxy server. Acceptable values are "none", "HTTP", "CONNECT", and "best". This property is used in Flex applications and Flash Media Server 2 applications.
public function get proxyType():String public function set proxyType(value:String):void| running | property |
running:Boolean [read-only]
Indicates true if the process is in progress.
public function get running():Boolean| startIt | property |
startIt:SignalerThis signal emit when the notifyStarted method is invoked.
public function get startIt():Signaler public function set startIt(value:Signaler):void| unconnectedPeerStreams | property |
unconnectedPeerStreams:Array [read-only] An object that holds all of the peer subscriber NetStream objects that are not associated with publishing NetStream objects.
public function get unconnectedPeerStreams():Array| uri | property |
uri:StringThe URI of the application server that was passed to NetConnection.connect(), if connect was used to connect to a server. If NetConnection.connect() hasn't yet been called or if no URI was passed, this property is undefined. This property is a read-write property and we can use this property in to launch the connect process with the run method.
public function get uri():String public function set uri(value:String):voidSee also
| usingTLS | property |
usingTLS:Boolean [read-only] Indicates whether a secure connection was made using native Transport Layer Security (TLS) rather than HTTPS. This property is valid only when a NetConnection object is connected.
public function get usingTLS():Boolean| NetServerConnection | () | Constructor |
public function NetServerConnection(global:Boolean = false, channel:String = null)Creates a new NetServerConnection instance.
Parametersglobal:Boolean (default = false) — the flag to use a global event flow or a local event flow.
| |
channel:String (default = null) — the name of the global event flow if the global argument is true.
|
| addHeader | () | method |
public function addHeader(operation:String, mustUnderstand:Boolean = false, param:Object = null):voidAdds a context header to the AMF packet structure. This header is sent with every future AMF packet.
Parameters
operation:String — A string; identifies the header and the ActionScript object data associated with it.
| |
mustUnderstand:Boolean (default = false) — A Boolean value; true indicates that the server must understand and process this header before it handles any of the following headers or messages.
| |
param:Object (default = null) — Any ActionScript object.
|
| call | () | method |
public function call(command:String, responder:Responder, ... rest):BooleanInvokes a command or method on the server running Flash Media Server, or on an application server, to which the application instance is connected. You must create a server-side function to pass to this method.
Parameters
command:String — A method specified in the form [objectPath/]method.
| |
responder:Responder — An optional object that is used to handle return values from the server.
| |
... rest — arguments Optional arguments that can be of any ActionScript type, including a reference to another ActionScript object.
These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.
|
Boolean — For RTMP connections, returns a Boolean value of true if a call to methodName is sent to the client ; otherwise, false.
For application server connections, it always returns true.
|
| clone | () | method |
public function clone():*Returns the shallow copy of this object.
Returns* — the shallow copy of this object.
|
| close | () | method |
public function close(noEvent:Boolean = false):BooleanCloses the connection that was opened locally or with the server and dispatches the netStatus event with a code property of NetConnection.Connect.Closed.
Parameters
noEvent:Boolean (default = false) |
Boolean — A boolean to indicates if the connection is closed.
|
| connect | () | method |
public function connect(command:String, ... arguments):voidConnect the client with this method.
Parameters
command:String | |
... arguments |
| getDelay | () | method |
public function getDelay():uintReturns timeout interval duration.
Returnsuint |
| getTimeoutPolicy | () | method |
public function getTimeoutPolicy():TimeoutPolicyReturns the TimeoutPolicy value of this object.
ReturnsTimeoutPolicy — the TimeoutPolicy value of this object.
|
See also
| notifyFinished | () | method |
public function notifyFinished():voidInvoked when the connection is finished.
| notifyNetServerEvent | () | method |
protected function notifyNetServerEvent(type:String, status:NetServerStatus = null, info:* = null):voidInvoked when the connection is closed.
Parameters
type:String | |
status:NetServerStatus (default = null) | |
info:* (default = null) |
| notifyStarted | () | method |
public function notifyStarted():voidInvoked when the connection is started.
| notifyTimeOut | () | method |
protected function notifyTimeOut():voidInvoked when the connection is timeout.
| run | () | method |
public function run(... arguments):voidRuns the process of this NetServerConnection.
Parameters
... arguments |
| setDelay | () | method |
public function setDelay(n:Number, useSeconds:Boolean):voidSet timeout interval duration.
Parameters
n:Number | |
useSeconds:Boolean |
| setLimitPolicy | () | method |
public function setLimitPolicy(policy:TimeoutPolicy):voidUse limit timeout interval.
Parameters
policy:TimeoutPolicy |
See also
| setRunning | () | method |
protected function setRunning(b:Boolean):voidChanges the running property value.
Parameters
b:Boolean |
| sharedEvent | () | method |
public function sharedEvent(event:* = null, context:* = null):voidUse this method to dispatch in FMS application an event.
Parameters
event:* (default = null) | |
context:* (default = null) |
| DEFAULT_DELAY | Constant |
public static const DEFAULT_DELAY:uint = 8000The default internal timeout delay value in milliseconds.