| Package | com.developmentarc.framework.utils |
| Class | public class LocalConnectionManager |
| Inheritance | LocalConnectionManager flash.events.EventDispatcher |
To use this utility create a new instance of the Class providing the target Object that methods send from another LocalConnection should be applied to, create a connection to expose this application to other LCM enabled applications and then brodacast messages with sendMessage() method.
| Property | Defined by | ||
|---|---|---|---|
| connected : Boolean [read-only]
Used to determine of the LocalConnectionManager has an active connection.
| LocalConnectionManager | ||
| Property | Defined by | ||
|---|---|---|---|
| connection : LocalConnection
Stores the LC instance for the Class.
| LocalConnectionManager | ||
| connectionTarget : Object
Stores the connection target object that should be called when a message from the LC is received.
| LocalConnectionManager | ||
| currentConnectionName : String
Stores the connection name for the current application for communication.
| LocalConnectionManager | ||
| currentDomainList : Array
Stores the current domain list that was defined at construction.
| LocalConnectionManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
LocalConnectionManager(connTarget:Object, connectionName:String, domainList:Array = null, autoConnect:Boolean = true)
Constructor.
| LocalConnectionManager | ||
|
addDomain(domainArray:Array):void
Updates the approved domain list on the LocalConnection.
| LocalConnectionManager | ||
|
connect(connectionName:String, domainList:Array = null):void
Used to connect to a local connection name.
| LocalConnectionManager | ||
|
disconnect():void
Ends the current local conenction session and removes all handlers
so that Garbage collection can occur.
| LocalConnectionManager | ||
|
sendMessage(target:String, methodName:String, ... args):void
Calls the application via the target name and method defined in the arguments.
| LocalConnectionManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
handleAsyncEvent(event:AsyncErrorEvent):void
Used to track Async errors from the LC instance.
| LocalConnectionManager | ||
|
handleStatusEvent(event:StatusEvent):void
Used to track Status events from the LC instance.
| LocalConnectionManager | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| LocalConnectionManager | ||||
| LocalConnectionManager | ||||
| LocalConnectionManager | ||||
| connected | property |
connected:Boolean [read-only]Used to determine of the LocalConnectionManager has an active connection.
Implementation public function get connected():Boolean
| connection | property |
protected var connection:LocalConnectionStores the LC instance for the Class.
| connectionTarget | property |
protected var connectionTarget:ObjectStores the connection target object that should be called when a message from the LC is received.
| currentConnectionName | property |
protected var currentConnectionName:StringStores the connection name for the current application for communication.
| currentDomainList | property |
protected var currentDomainList:ArrayStores the current domain list that was defined at construction.
| LocalConnectionManager | () | constructor |
public function LocalConnectionManager(connTarget:Object, connectionName:String, domainList:Array = null, autoConnect:Boolean = true)Constructor. Creates a new instance of a LCM and establishes the LocalConnection instance during construction.
The constructor also opens the application for communication with other LCM enabled applications based on the name provided. For other LCM enabled apps to successfully communicate the app must be on an approved domain and know the name that is defined for this application. Only one application at a time can be connected via the provided name. If an application is already connected via this name the LCM will dispatch a LocalConnectionEvent.CONNECTION_ERROR. If a connection name is not provided then the two error communication will not be able to function, this is why the argument is required.
ParametersconnTarget:Object — This is the object that LC message calls are applied to when received from another applicaiton.
|
|
connectionName:String — The application communication name
|
|
domainList:Array (default = null) — An array of domains to allow communication with the LC, if no value is set the default is '.
|
|
autoConnect:Boolean (default = true) — Determines if the manager should attempt to auto connect on construction.
|
| addDomain | () | method |
public function addDomain(domainArray:Array):voidUpdates the approved domain list on the LocalConnection.
ParametersdomainArray:Array — A list of strings that represent the allowed domains.
|
| connect | () | method |
public function connect(connectionName:String, domainList:Array = null):voidUsed to connect to a local connection name. If the local connection is not connected this method creates a new connection and connects to the name provided. If a name is not provided the default name defined at the construction is used or the last name called via the connect method.
If a connection is currently established, this method disconnects from the exisiting connection and creates a new connection.
ParametersconnectionName:String |
|
domainList:Array (default = null) |
| disconnect | () | method |
public function disconnect():voidEnds the current local conenction session and removes all handlers so that Garbage collection can occur.
| handleAsyncEvent | () | method |
protected function handleAsyncEvent(event:AsyncErrorEvent):voidUsed to track Async errors from the LC instance.
Parametersevent:AsyncErrorEvent — AsyncEvent thrown by the LC.
|
| handleStatusEvent | () | method |
protected function handleStatusEvent(event:StatusEvent):voidUsed to track Status events from the LC instance.
Parametersevent:StatusEvent — Status event from the LC.
|
| sendMessage | () | method |
public function sendMessage(target:String, methodName:String, ... args):voidCalls the application via the target name and method defined in the arguments. This method retains the Class definitions and marks the arguments according to their type so that the receiving application can re-cast back to the correct Class. The receiving application must have the same defined type and the method argument count must match both order and type in order for the call to be successfully completed.
Parameterstarget:String — The name of the application exposed via connectionName to call the method on.
|
|
methodName:String — The method to call on the target application.
|
|
... args — Common seperated argument values for the defined method.
|
| connectionError | event |
| sentMessageError | event |
| statusMessage | event |