Packagevegas.net
Classpublic class Connection
InheritanceConnection Inheritance flash.net.NetConnection
Implements Action

The Connection class creates a two-way connection between a client and a server. The client can be a Flash Player or AIR application. The server can be a web server, Flash Media Server, an application server running Flash Remoting, or the Adobe Stratus service. Call Connection.connect() to establish the connection. Use the NetStream class to send streams of media and data over the connection.



Public Properties
 PropertyDefined By
  callBadVersion : Signaler
This signal emit when a packet encoded in an unidentified format.
Connection
  callFailed : Signaler
This signal emit when the call method was not able to invoke the server-side method or command.
Connection
  callProhibited : Signaler
This signal emit when an Action Message Format (AMF) operation is prevented for security reasons.
Connection
  connectAppShutDown : Signaler
This signal emit when the specified application is shutting down.
Connection
  connectClosed : Signaler
This signal emit when the connection was closed successfully.
Connection
  connectFailed : Signaler
This signal emit when the connection attempt failed.
Connection
  connectInvalidApp : Signaler
This signal emit when the application name specified during connect is invalid.
Connection
  connectNetworkChange : Signaler
This signal emit when the Flash Player has detected a network change, for example, a dropped wireless connection, a successful wireless connection,or a network cable loss.
Connection
  connectRejected : Signaler
This signal emit when the connection attempt did not have permission to access the application.
Connection
  connectSuccess : Signaler
This signal emit when the connection attempt succeeded.
Connection
  delay : Number
[read-only] Indicates the timeout interval duration.
Connection
  finishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Connection
  infoIt : Signaler
This signal emit when the notifyInfo method is invoked.
Connection
  phase : String
[read-only] The current phase of the action.
Connection
  running : Boolean
[read-only] Indicates true if the process is in progress.
Connection
  startIt : Signaler
This signal emit when the notifyStarted method is invoked.
Connection
  timeoutPolicy : TimeoutPolicy
Indicates the timeout policy of the connection (TimeoutPolicy.LIMIT or TimeoutPolicy.INFINITY)
Connection
  uri : String
[override] The URI of the application server that was passed to NetConnection.connect(), if connect was used to connect to a server.
Connection
Public Methods
 MethodDefined By
  
Creates a new Connection instance.
Connection
  
clone():*
Returns the shallow copy of this object.
Connection
  
close():void
[override] Closes the connection that was opened locally or with the server and dispatches the netStatus event with a code property of NetConnection.Connect.Closed.
Connection
  
connect(command:String, ... arguments):void
[override] Connect the client with this method.
Connection
  
Notify when the connection is finished.
Connection
  
notifyInfo(info:*):void
Notify a specific information when the process is changed.
Connection
  
Notify when the connection is started.
Connection
  
Notify when the connection is out of time.
Connection
  
registerEventListener(type:String, listener:*, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an system.events.EventListener object with an system.events.EventDispatcher object so that the listener receives notification of an event.
Connection
  
run(... arguments):void
Runs the process.
Connection
  
setDelay(delay:Number, useSeconds:Boolean):void
Set timeout interval duration.
Connection
  
unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes an system.events.EventListener from the system.events.EventDispatcher object.
Connection
Protected Methods
 MethodDefined By
  
setRunning(b:Boolean):void
Changes the running property value.
Connection
Events
 Event Summary Defined By
  Dispatched when a process is finished.Connection
  Dispatched when an info process is running.Connection
  Dispatched when a process is started.Connection
  Dispatched when a process is out of time.Connection
Public Constants
 ConstantDefined By
  DEFAULT_DELAY : uint = 8000
[static] The default internal timeout delay value in milliseconds.
Connection
Property Detail
callBadVersionproperty
callBadVersion:Signaler

This signal emit when a packet encoded in an unidentified format.


Implementation
    public function get callBadVersion():Signaler
    public function set callBadVersion(value:Signaler):void
callFailedproperty 
callFailed:Signaler

This signal emit when the call method was not able to invoke the server-side method or command.


Implementation
    public function get callFailed():Signaler
    public function set callFailed(value:Signaler):void
callProhibitedproperty 
callProhibited:Signaler

This signal emit when an Action Message Format (AMF) operation is prevented for security reasons.


Implementation
    public function get callProhibited():Signaler
    public function set callProhibited(value:Signaler):void
connectAppShutDownproperty 
connectAppShutDown:Signaler

This signal emit when the specified application is shutting down.


Implementation
    public function get connectAppShutDown():Signaler
    public function set connectAppShutDown(value:Signaler):void
connectClosedproperty 
connectClosed:Signaler

This signal emit when the connection was closed successfully.


Implementation
    public function get connectClosed():Signaler
    public function set connectClosed(value:Signaler):void
connectFailedproperty 
connectFailed:Signaler

This signal emit when the connection attempt failed.


Implementation
    public function get connectFailed():Signaler
    public function set connectFailed(value:Signaler):void
connectInvalidAppproperty 
connectInvalidApp:Signaler

This signal emit when the application name specified during connect is invalid.


Implementation
    public function get connectInvalidApp():Signaler
    public function set connectInvalidApp(value:Signaler):void
connectNetworkChangeproperty 
connectNetworkChange:Signaler

This signal emit when the Flash Player has detected a network change, for example, a dropped wireless connection, a successful wireless connection,or a network cable loss.


Implementation
    public function get connectNetworkChange():Signaler
    public function set connectNetworkChange(value:Signaler):void
connectRejectedproperty 
connectRejected:Signaler

This signal emit when the connection attempt did not have permission to access the application.


Implementation
    public function get connectRejected():Signaler
    public function set connectRejected(value:Signaler):void
connectSuccessproperty 
connectSuccess:Signaler

This signal emit when the connection attempt succeeded.


Implementation
    public function get connectSuccess():Signaler
    public function set connectSuccess(value:Signaler):void
delayproperty 
delay:Number  [read-only]

Indicates the timeout interval duration.


Implementation
    public function get delay():Number
finishItproperty 
finishIt:Signaler

This signal emit when the notifyFinished method is invoked.


Implementation
    public function get finishIt():Signaler
    public function set finishIt(value:Signaler):void
infoItproperty 
infoIt:Signaler

This signal emit when the notifyInfo method is invoked.


Implementation
    public function get infoIt():Signaler
    public function set infoIt(value:Signaler):void
phaseproperty 
phase:String  [read-only]

The current phase of the action.


Implementation
    public function get phase():String

See also

runningproperty 
running:Boolean  [read-only]

Indicates true if the process is in progress.


Implementation
    public function get running():Boolean
startItproperty 
startIt:Signaler

This signal emit when the notifyStarted method is invoked.


Implementation
    public function get startIt():Signaler
    public function set startIt(value:Signaler):void
timeoutPolicyproperty 
timeoutPolicy:TimeoutPolicy

Indicates the timeout policy of the connection (TimeoutPolicy.LIMIT or TimeoutPolicy.INFINITY)


Implementation
    public function get timeoutPolicy():TimeoutPolicy
    public function set timeoutPolicy(value:TimeoutPolicy):void

See also

uriproperty 
uri:String[override]

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


Implementation
    public function get uri():String
    public function set uri(value:String):void

See also

Runnable
Constructor Detail
Connection()Constructor
public function Connection()

Creates a new Connection instance.

Method Detail
clone()method
public function clone():*

Returns the shallow copy of this object.

Returns
* — the shallow copy of this object.
close()method 
override public function close():void

Closes the connection that was opened locally or with the server and dispatches the netStatus event with a code property of NetConnection.Connect.Closed.

connect()method 
override public function connect(command:String, ... arguments):void

Connect the client with this method.

Parameters

command:String
 
... arguments

notifyFinished()method 
public function notifyFinished():void

Notify when the connection is finished.

notifyInfo()method 
public function notifyInfo(info:*):void

Notify a specific information when the process is changed.

Parameters

info:*

notifyStarted()method 
public function notifyStarted():void

Notify when the connection is started.

notifyTimeOut()method 
public function notifyTimeOut():void

Notify when the connection is out of time.

registerEventListener()method 
public function registerEventListener(type:String, listener:*, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an system.events.EventListener object with an system.events.EventDispatcher object so that the listener receives notification of an event.

Parameters

type:String
 
listener:*
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)

run()method 
public function run(... arguments):void

Runs the process.

Parameters

... arguments

setDelay()method 
public function setDelay(delay:Number, useSeconds:Boolean):void

Set timeout interval duration.

Parameters

delay:Number
 
useSeconds:Boolean

setRunning()method 
protected function setRunning(b:Boolean):void

Changes the running property value.

Parameters

b:Boolean

unregisterEventListener()method 
public function unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void

Removes an system.events.EventListener from the system.events.EventDispatcher object.

Parameters

type:String
 
listener:*
 
useCapture:Boolean (default = false)

Event Detail
finish Event
Event Object Type: system.events.ActionEvent
ActionEvent.type property = system.events.ActionEvent.FINISH

Dispatched when a process is finished.

The name of the event when the process is finished.

See also

info Event  
Event Object Type: system.events.ActionEvent
ActionEvent.type property = system.events.ActionEvent.INFO

Dispatched when an info process is running.

The name of the event when the process info is changed.

See also

start Event  
Event Object Type: system.events.ActionEvent
ActionEvent.type property = system.events.ActionEvent.START

Dispatched when a process is started.

The name of the event when the process is started.

See also

timeout Event  
Event Object Type: system.events.ActionEvent
ActionEvent.type property = system.events.ActionEvent.TIMEOUT

Dispatched when a process is out of time.

The name of the event when the process is cleared.

See also

Constant Detail
DEFAULT_DELAYConstant
public static const DEFAULT_DELAY:uint = 8000

The default internal timeout delay value in milliseconds.