Package | net.user1.reactor |
Class | public class ReactorEvent |
Inheritance | ReactorEvent ![]() |
Since : | Reactor 1.0.0 |
ReactorEvent is a simple data class used to pass information from an application's Reactor object to registered event-listeners when a Reactor event occurs. The ReactorEvent class also defines constants representing the available Reactor events.
To register for a Reactor event, use Reactor's addEventListener() method, as shown in the following code:
reactor = new Reactor(); reactor.addEventListener(ReactorEvent.READY, readyListener);
private function readyListener (e:ReactorEvent):void { chatRoom = reactor.getRoomManager().createRoom("examples.chat"); chatRoom.join(); }
See also
Method | Defined By | ||
---|---|---|---|
ReactorEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, serverUPCVersion:VersionNumber = null, connectionRefusal:ConnectionRefusal = null)
Constructor. | ReactorEvent | ||
clone():Event [override] | ReactorEvent | ||
Returns a ConnectionRefusal object describing a connection refusal by
Union Server. | ReactorEvent | ||
Returns the version of the UPC specification in use by the
server. | ReactorEvent | ||
toString():String [override] | ReactorEvent |
Constant | Defined By | ||
---|---|---|---|
CLOSE : String = CLOSE [static]
Dispatched when either the connection to the server is lost
or a connection attempt fails. | ReactorEvent | ||
CONNECT_REFUSED : String = CONNECT_REFUSED [static]
Dispatched when the client attempts to connect to Union Server, but the
connection is refused. | ReactorEvent | ||
PROTOCOL_INCOMPATIBLE : String = PROTOCOL_INCOMPATIBLE [static]
Dispatched when the client connects to
a Union Server that conforms to a version of the UPC specification that
does not match the client's UPC version. | ReactorEvent | ||
READY : String = READY [static]
Dispatched when a connection to the server has been
established and fully initialized. | ReactorEvent |
ReactorEvent | () | Constructor |
public function ReactorEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, serverUPCVersion:VersionNumber = null, connectionRefusal:ConnectionRefusal = null)
Constructor.
Parameterstype:String | |
bubbles:Boolean (default = false )
| |
cancelable:Boolean (default = false )
| |
serverUPCVersion:VersionNumber (default = null )
| |
connectionRefusal:ConnectionRefusal (default = null )
|
clone | () | method |
override public function clone():Event
ReturnsEvent |
getConnectionRefusal | () | method |
public function getConnectionRefusal():ConnectionRefusal
Since : | Reactor 1.1.1 |
Returns a ConnectionRefusal object describing a connection refusal by Union Server. Applies to the ReactorEvent.CONNECT_REFUSED event only.
ReturnsConnectionRefusal |
See also
getServerUPCVersion | () | method |
public function getServerUPCVersion():VersionNumber
Since : | Reactor 1.0.0 |
Returns the version of the UPC specification in use by the server. Applies to the ReactorEvent.PROTOCOL_INCOMPATIBLE event only.
ReturnsVersionNumber |
See also
toString | () | method |
override public function toString():String
ReturnsString |
CLOSE | Constant |
public static const CLOSE:String = CLOSE
Since : | Reactor 1.0.0 |
Dispatched when either the connection to the server is lost or a connection attempt fails. Individual events for connection failure and connection closure can be handled separately via the ConnectionManager class or any class that implements IConnection.
See also
CONNECT_REFUSED | Constant |
public static const CONNECT_REFUSED:String = CONNECT_REFUSED
Since : | Reactor 1.1.1 |
Dispatched when the client attempts to connect to Union Server, but the connection is refused. To determine why the client connection was refused, use getConnectionRefusal().
See also
protected function connectRefusedListener (e:ReactorEvent):void { if (e.getConnectionRefusal().reason == ConnectionRefusalReason.BANNED) { trace("Sorry, you cannot connect because you were banned for the " + " following reason: " + e.getConnectionRefusal().banReason); trace("The ban started at:" + new Date(e.getConnectionRefusal().bannedAt)); trace("The ban duration is: " + NumericFormatter.msToElapsedDayHrMinSec(e.getConnectionRefusal().banDuration000)); } }
PROTOCOL_INCOMPATIBLE | Constant |
public static const PROTOCOL_INCOMPATIBLE:String = PROTOCOL_INCOMPATIBLE
Since : | Reactor 1.0.0 |
Dispatched when the client connects to a Union Server that conforms to a version of the UPC specification that does not match the client's UPC version.
The UPC specification version takes format: majorNumber.minorNumber.revisionNumber. For example, in the version number 1.2.0, the majorNumber is 1, the minorNumber is 2, and the revisionNumber is 0. If the client's majorNumber, minorNumber, and revisionNumber all match the server's majorNumber, minorNumber, and revisionNumber, the server is considered compatible with the client. Otherwise:
The UPC specification is available at http://unionplatform.com/specs/upc/.
See also
READY | Constant |
public static const READY:String = READY
Since : | Reactor 1.0.0 |
Dispatched when a connection to the server has been established and fully initialized. After READY occurs, the Reactor client can begin communicating freely with the server.
See also