Package | net.user1.reactor |
Class | public class RoomEvent |
Inheritance | RoomEvent ![]() |
Since : | Reactor 1.0.0 |
// The event-registration code someRoom.addEventListener(RoomEvent.ADD_OCCUPANT, addOccupantListener); // The event-listener code protected function addOccupantListener (e:RoomEvent):void { trace("User " + e.getClient().getClientID() + " joined the room."); }
See also
Method | Defined By | ||
---|---|---|---|
RoomEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, client:IClient = null, clientID:String = null, status:String = null, changedAttr:Attribute = null, numClients:int = 0, roomID:String = null)
Constructor
| RoomEvent | ||
clone():Event [override] | RoomEvent | ||
Returns an Attribute object containing information about a changed
room or client attribute. | RoomEvent | ||
Returns a reference to the Client object pertaining to this event. | RoomEvent | ||
getClientID():String
Returns the id of the client pertaining to this event. | RoomEvent | ||
getNumClients():Number
Returns the number of clients currently in the room. | RoomEvent | ||
getRoomID():String
For RoomEvent events dispatched by RoomManager, getRoomID() returns the
roomID of the room pertaining to this event. | RoomEvent | ||
getStatus():String
Returns the status of the operation to which this event pertains. | RoomEvent | ||
toString():String [override] | RoomEvent |
Constant | Defined By | ||
---|---|---|---|
ADD_OBSERVER : String = ADD_OBSERVER [static]
Dispatched when a client observes a room and the following two conditions
are met: 1) the current client is in or observing the room, 2)
the current client has enabled "observer-list" updates for the room
(observer-list updates are disabled by default). | RoomEvent | ||
ADD_OCCUPANT : String = ADD_OCCUPANT [static]
Dispatched when a client joins a room and the following two conditions
are met: 1) the current client is in or observing the room, 2)
the current client has enabled "occupant-list" updates for the room
(occupant-list updates are enabled by default). | RoomEvent | ||
DELETE_CLIENT_ATTRIBUTE : String = DELETE_CLIENT_ATTRIBUTE [static]
Dispatched when the current client is in or observing the room, and an
attribute in which the current client has expressed interest is removed
from any of the room's occupants or observers. | RoomEvent | ||
JOIN : String = JOIN [static]
Dispatched when the current client successfully joins a room,
either in response to server-side code or in response to an
earlier request made by the current client to join the room. | RoomEvent | ||
JOIN_RESULT : String = JOIN_RESULT [static]
Dispatched when the result of an earlier room-join
request by the current client is received. | RoomEvent | ||
LEAVE : String = LEAVE [static]
Dispatched when the current client successfully leaves a room,
either in response to server-side code or in response to an
earlier request made by the current client to leave the room. | RoomEvent | ||
LEAVE_RESULT : String = LEAVE_RESULT [static]
Dispatched when the result of an earlier room-leave
request by the current client is received. | RoomEvent | ||
OBSERVE : String = OBSERVE [static]
Dispatched when the current client successfully observes a room,
either in response to server-side code or in response to an
earlier request made by the current client to observe the room. | RoomEvent | ||
OBSERVER_COUNT : String = OBSERVER_COUNT [static]
Dispatched when the number of observers in a room changes while the
current client is in or observing the room and the current client has
enabled either "observer-list" updates or "observer-count" updates for
the room (note that neither are enabled by default). | RoomEvent | ||
OBSERVE_RESULT : String = OBSERVE_RESULT [static]
Dispatched when the result of an earlier observe-room
request by the current client is received. | RoomEvent | ||
OCCUPANT_COUNT : String = OCCUPANT_COUNT [static]
Dispatched when the number of occupants in a room changes while the
current client is in or observing the room and the current client has
enabled either "occupant-list" updates or "occupant-count" updates for
the room (note that occupant-list updates are enabled by default). | RoomEvent | ||
REMOVED : String = REMOVED [static]
Dispatched when a room that was previously known to the current client
becomes unknown. | RoomEvent | ||
REMOVE_OBSERVER : String = REMOVE_OBSERVER [static]
Dispatched when a client stops observing a room and the following two conditions
are met: 1) the current client is in or observing the room, 2)
the current client has enabled "observer-list" updates for the room
(observer-list updates are disabled by default). | RoomEvent | ||
REMOVE_OCCUPANT : String = REMOVE_OCCUPANT [static]
Dispatched when a client leaves a room and the following two conditions
are met: 1) the current client is in or observing the room, 2)
the current client has enabled "occupant-list" updates for the room
(occupant-list updates are enabled by default). | RoomEvent | ||
STOP_OBSERVING : String = STOP_OBSERVING [static]
Dispatched when the current client succesfully stops observing
a room, either in response to server-side code or in response
to an earlier request made by the current client to stop
observing the room. | RoomEvent | ||
STOP_OBSERVING_RESULT : String = STOP_OBSERVING_RESULT [static]
Dispatched when the result of an earlier stop-observing-room
request by the current client is received. | RoomEvent | ||
SYNCHRONIZE : String = SYNCHRONIZE [static]
Dispatched when the room has been synchronized to match the
state of the server. | RoomEvent | ||
UPDATE_CLIENT_ATTRIBUTE : String = UPDATE_CLIENT_ATTRIBUTE [static]
Dispatched when the current client is in or observing the room, and an
attribute in which the current client has expressed interest changes on
any of the room's occupants or observers. | RoomEvent |
RoomEvent | () | Constructor |
public function RoomEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, client:IClient = null, clientID:String = null, status:String = null, changedAttr:Attribute = null, numClients:int = 0, roomID:String = null)
Constructor
Parameterstype:String | |
bubbles:Boolean (default = false )
| |
cancelable:Boolean (default = false )
| |
client:IClient (default = null )
| |
clientID:String (default = null )
| |
status:String (default = null )
| |
changedAttr:Attribute (default = null )
| |
numClients:int (default = 0 )
| |
roomID:String (default = null )
|
clone | () | method |
override public function clone():Event
ReturnsEvent |
getChangedAttr | () | method |
public function getChangedAttr():Attribute
Since : | Reactor 1.0.0 |
Returns an Attribute object containing information about a changed room or client attribute. This method applies to the following events:
Attribute |
getClient | () | method |
public function getClient():IClient
Since : | Reactor 1.0.0 |
Returns a reference to the Client object pertaining to this event. This method applies to the following events:
IClient |
getClientID | () | method |
public function getClientID():String
Since : | Reactor 1.0.0 |
Returns the id of the client pertaining to this event. This method applies to the following events:
String |
getNumClients | () | method |
public function getNumClients():Number
Since : | Reactor 1.0.0 |
Returns the number of clients currently in the room. This method applies to the following events:
Number |
getRoomID | () | method |
public function getRoomID():String
Since : | Reactor 1.0.0 |
For RoomEvent events dispatched by RoomManager, getRoomID() returns the roomID of the room pertaining to this event. For example, when RoomManager dispatches the RoomEvent.JOIN_RESULT event, getRoomID() returns the room ID of the room that the client attempted to join. For RoomEvent events dispatched by an individual Room object, getRoomID() always returns null. To retrieve a room ID for events dispatched by an individual room object, use the Event class's target variable within the RoomEvent event listener. For example,
protected function joinListener (e:RoomEvent) { trace(Room(e.target).getRoomID()); }
String |
getStatus | () | method |
public function getStatus():String
Since : | Reactor 1.0.0 |
Returns the status of the operation to which this event pertains. The getStatus() method's return value is always one of the Status class's constants. For example, if the RoomEvent.JOIN_RESULT event occurs in response to a successful room-join attempt, getStatus() will return the value of Status.SUCCESS. To respond to a status, compare the return of getStatus() to one of the Status constants. For example,
if (e.getStatus() != Status.SUCCESS) { showJoinFailedScreen(); }
String |
See also
toString | () | method |
override public function toString():String
ReturnsString |
ADD_OBSERVER | Constant |
public static const ADD_OBSERVER:String = ADD_OBSERVER
Since : | Reactor 1.0.0 |
Dispatched when a client observes a room and the following two conditions are met: 1) the current client is in or observing the room, 2) the current client has enabled "observer-list" updates for the room (observer-list updates are disabled by default). To enable or disable observer-list updates for a room, set the observerList variable on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code enables observer-list updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.observerList = true; theRoom.setUpdateLevels(updateLevels);
See also
ADD_OCCUPANT | Constant |
public static const ADD_OCCUPANT:String = ADD_OCCUPANT
Since : | Reactor 1.0.0 |
Dispatched when a client joins a room and the following two conditions are met: 1) the current client is in or observing the room, 2) the current client has enabled "occupant-list" updates for the room (occupant-list updates are enabled by default). To enable or disable occupant-list updates for a room, set the occupantList variable on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code disables occupant-list updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.occupantList = false; theRoom.setUpdateLevels(updateLevels);
See also
DELETE_CLIENT_ATTRIBUTE | Constant |
public static const DELETE_CLIENT_ATTRIBUTE:String = DELETE_CLIENT_ATTRIBUTE
Since : | Reactor 1.0.0 |
Dispatched when the current client is in or observing the room, and an attribute in which the current client has expressed interest is removed from any of the room's occupants or observers. Specifically, RoomEvent.DELETE_CLIENT_ATTRIBUTE is triggered when any of the following occurs:
To enable or disable occupant or observer attribute updates for a room, first, set any of the following variables on an UpdateLevels object:
For example, the following code disables all shared attribute updates for occupants of the room referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.sharedOccupantAttributesRoom = false; updateLevels.sharedOccupantAttributesGlobal = false; theRoom.setUpdateLevels(updateLevels);
See also
JOIN | Constant |
public static const JOIN:String = JOIN
Since : | Reactor 1.0.0 |
Dispatched when the current client successfully joins a room, either in response to server-side code or in response to an earlier request made by the current client to join the room.
Note that the RoomEvent.JOIN event applies to the current client only. To be notified when any client joins a room, register for the RoomEvent.ADD_OCCUPANT event.
See also
JOIN_RESULT | Constant |
public static const JOIN_RESULT:String = JOIN_RESULT
Since : | Reactor 1.0.0 |
Dispatched when the result of an earlier room-join request by the current client is received. To determine the result of the request, use getStatus(), which has the following possible return values:
If the room-join request was successful, the RoomEvent.JOIN event will also be triggered.
See also
LEAVE | Constant |
public static const LEAVE:String = LEAVE
Since : | Reactor 1.0.0 |
Dispatched when the current client successfully leaves a room, either in response to server-side code or in response to an earlier request made by the current client to leave the room.
Note that the RoomEvent.LEAVE event applies to the current client only. To be notified when any client leaves a room, register for the RoomEvent.REMOVE_OCCUPANT event.
LEAVE_RESULT | Constant |
public static const LEAVE_RESULT:String = LEAVE_RESULT
Since : | Reactor 1.0.0 |
Dispatched when the result of an earlier room-leave request by the current client is received. To determine the result of the request, use getStatus(), which has the following possible return values:
If the leave-join request was successful, the RoomEvent.LEAVE event will also be triggered.
See also
OBSERVE | Constant |
public static const OBSERVE:String = OBSERVE
Since : | Reactor 1.0.0 |
Dispatched when the current client successfully observes a room, either in response to server-side code or in response to an earlier request made by the current client to observe the room. Note that RoomEvent.OBSERVE applies to the current client only; to be notified when other clients observe the room, register for the RoomEvent.ADD_OBSERVER event.
See also
OBSERVE_RESULT | Constant |
public static const OBSERVE_RESULT:String = OBSERVE_RESULT
Since : | Reactor 1.0.0 |
Dispatched when the result of an earlier observe-room request by the current client is received. To determine the result of the request, use getStatus(), which has the following possible return values:
See also
OBSERVER_COUNT | Constant |
public static const OBSERVER_COUNT:String = OBSERVER_COUNT
Since : | Reactor 1.0.0 |
Dispatched when the number of observers in a room changes while the current client is in or observing the room and the current client has enabled either "observer-list" updates or "observer-count" updates for the room (note that neither are enabled by default). To enable or disable observer-list updates or observer-count updates for a room, set either the observerList variable or the observerCount variable (respectively) on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code enables observer-count updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.observerCount = true; theRoom.setUpdateLevels(updateLevels);
See also
OCCUPANT_COUNT | Constant |
public static const OCCUPANT_COUNT:String = OCCUPANT_COUNT
Since : | Reactor 1.0.0 |
Dispatched when the number of occupants in a room changes while the current client is in or observing the room and the current client has enabled either "occupant-list" updates or "occupant-count" updates for the room (note that occupant-list updates are enabled by default). To enable or disable occupant-list updates or occupant-count updates for a room, set either the occupantList variable or the occupantCount variable (respectively) on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code disables occupant-list updates and enables occupant-count updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.occupantList = false; updateLevels.occupantCount = true; theRoom.setUpdateLevels(updateLevels);
See also
REMOVE_OBSERVER | Constant |
public static const REMOVE_OBSERVER:String = REMOVE_OBSERVER
Since : | Reactor 1.0.0 |
Dispatched when a client stops observing a room and the following two conditions are met: 1) the current client is in or observing the room, 2) the current client has enabled "observer-list" updates for the room (observer-list updates are disabled by default). To enable or disable observer-list updates for a room, set the observerList variable on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code enables observer-list updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.observerList = true; theRoom.setUpdateLevels(updateLevels);
See also
REMOVE_OCCUPANT | Constant |
public static const REMOVE_OCCUPANT:String = REMOVE_OCCUPANT
Since : | Reactor 1.0.0 |
Dispatched when a client leaves a room and the following two conditions are met: 1) the current client is in or observing the room, 2) the current client has enabled "occupant-list" updates for the room (occupant-list updates are enabled by default). To enable or disable occupant-list updates for a room, set the occupantList variable on an UpdateLevels object, and pass that object to one of the following methods:
For example, the following code disables occupant-list updates for the Room object referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.occupantList = false; theRoom.setUpdateLevels(updateLevels);
See also
REMOVED | Constant |
public static const REMOVED:String = REMOVED
Since : | Reactor 1.0.0 |
Dispatched when a room that was previously known to the current client becomes unknown. A room is known when it is cached, joined, observed, or watched by the current client. For information on the current client's room cache, see RoomManager's disposeCachedRooms() method.
See also
STOP_OBSERVING | Constant |
public static const STOP_OBSERVING:String = STOP_OBSERVING
Since : | Reactor 1.0.0 |
Dispatched when the current client succesfully stops observing a room, either in response to server-side code or in response to an earlier request made by the current client to stop observing the room.
See also
STOP_OBSERVING_RESULT | Constant |
public static const STOP_OBSERVING_RESULT:String = STOP_OBSERVING_RESULT
Since : | Reactor 1.0.0 |
Dispatched when the result of an earlier stop-observing-room request by the current client is received. To determine the result of the request, use getStatus(), which has the following possible return values:
See also
SYNCHRONIZE | Constant |
public static const SYNCHRONIZE:String = SYNCHRONIZE
Since : | Reactor 1.0.0 |
Dispatched when the room has been synchronized to match the state of the server. A room is synchronized when the current client joins or observes it.
See also
UPDATE_CLIENT_ATTRIBUTE | Constant |
public static const UPDATE_CLIENT_ATTRIBUTE:String = UPDATE_CLIENT_ATTRIBUTE
Since : | Reactor 1.0.0 |
Dispatched when the current client is in or observing the room, and an attribute in which the current client has expressed interest changes on any of the room's occupants or observers. Specifically, RoomEvent.UPDATE_CLIENT_ATTRIBUTE is triggered when any of the following occurs:
To enable or disable occupant or observer attribute updates for a room, first, set any of the following variables on an UpdateLevels object:
For example, the following code enables room-scoped shared-attribute updates for observers of the room referenced by theRoom:
var updateLevels:UpdateLevels = new UpdateLevels(); updateLevels.sharedObserverAttributesRoom = true; theRoom.setUpdateLevels(updateLevels);
See also