Packagenet.user1.reactor
Classpublic class ReactorEvent
InheritanceReactorEvent Inheritance flash.events.Event

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);
   
The following code shows a ReactorEvent.READY event listener that creates a chat room and then joins it.
   private function readyListener (e:ReactorEvent):void {
     chatRoom = reactor.getRoomManager().createRoom("examples.chat");
     chatRoom.join();
   }
   

See also

Reactor
Reactor.addEventListener()


Public Methods
 MethodDefined 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
Public Constants
 ConstantDefined 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
Constructor Description
ReactorEvent()Constructor
public function ReactorEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, serverUPCVersion:VersionNumber = null, connectionRefusal:ConnectionRefusal = null)

Constructor.

Parameters
type:String
 
bubbles:Boolean (default = false)
 
cancelable:Boolean (default = false)
 
serverUPCVersion:VersionNumber (default = null)
 
connectionRefusal:ConnectionRefusal (default = null)
Method Descriptions
clone()method
override public function clone():Event

Returns
Event
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.

Returns
ConnectionRefusal

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.

Returns
VersionNumber

See also

toString()method 
override public function toString():String

Returns
String
Constant Descriptions
CLOSEConstant
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_REFUSEDConstant 
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


Example
The following code shows a ReactorEvent.CONNECT_REFUSED listener that displays the details of a connection refusal for a banned client.
     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_INCOMPATIBLEConstant 
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

READYConstant 
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