Packagenet.user1.reactor.snapshot
Classpublic class RoomSnapshot
InheritanceRoomSnapshot Inheritance Snapshot Inheritance flash.events.EventDispatcher

Since : Reactor 1.0.0

The RoomSnapshot class is used to load a "snapshot" of a room on the server. The snapshot includes all of the room's attributes, plus a list of the clients in the room and a list of the clients observing room. For example, the following code retrieves a snapshot of the room with the roomID "examples.chat".
   // Create the snapshot
   var snapshot:RoomSnapshot = new RoomSnapshot("examples.chat");
   
   // Register a callback function
   snapshot.onLoad = function ():void { 
     // Display a list of clients in the room
     trace("Occupants: " + snapshot.getOccupants());
   }
   
   // Or register a listener function
   snapshot.addEventListener(SnapshotEvent.LOAD, loadListener);
   function loadListener (e:SnapshotEvent):void {
     // Display a list of clients in the room
     trace("Occupants: " + RoomSnapshot(e.target).getOccupants());
   }
   
   // Load the room's data by passing the snapshot object to 
   // Reactor's updateSnapshot() method:
   reactor.updateSnapshot(snapshot);
   

The RoomSnapshot object is not kept up to date after it is loaded. To update a RoomSnapshot object to match latest the state of the server, pass that object to Reactor's updateSnapshot() method.

See also

SnapshotEvent
Snapshot
net.user1.reactor.Reactor.updateSnapshot()


Public Variables
 VariableDefined By
 InheritedonLoad : Function
A callback function to be invoked when this snapshot's data is loaded.
Snapshot
Public Methods
 MethodDefined By
  
RoomSnapshot(roomID:String, password:String = null, updateLevels:UpdateLevels = null)
Constructor
RoomSnapshot
  
getAttribute(name:String):String
Returns the value of the specified room attribute.
RoomSnapshot
  
getAttributes():Object
Returns an object whose variables represent the names and values of the shared attributes for this snapshot's room.
RoomSnapshot
  
Returns the number of observers in the room represented by this snapshot.
RoomSnapshot
  
Returns the number of occupants in the room represented by this snapshot.
RoomSnapshot
  
getObserver(clientID:String):ClientManifest
Returns a ClientManifest object representing the room observer specified by clientID.
RoomSnapshot
  
getObservers():Array
Returns a list of the clients observing the room represented by this snapshot.
RoomSnapshot
  
getOccupant(clientID:String):ClientManifest
Returns a ClientManifest object representing the room occupant specified by clientID.
RoomSnapshot
  
getOccupants():Array
Returns a list of the clients in the room represented by this snapshot.
RoomSnapshot
  
getRoomID():String
Returns the fully qualified roomID for this room snapshot object.
RoomSnapshot
 Inherited
getStatus():String
Returns the status of the most recent snapshot load-operation.
Snapshot
 Inherited
Indicates whether the snapshot is currently loading data.
Snapshot
Events
 Event Summary Defined By
 Inherited Dispatched when a snapshot object has been updated in response to an earlier call to Reactor's updateSnapshot() method.Snapshot
 Inherited Dispatched when the result of an update request has been received by a snapshot object.Snapshot
Constructor Description
RoomSnapshot()Constructor
public function RoomSnapshot(roomID:String, password:String = null, updateLevels:UpdateLevels = null)

Constructor

Parameters
roomID:String
 
password:String (default = null)
 
updateLevels:UpdateLevels (default = null)

See also

UpdateLevels
Method Descriptions
getAttribute()method
public function getAttribute(name:String):String

Since : Reactor 1.0.0

Returns the value of the specified room attribute.

Parameters

name:String — The attribute's name.

Returns
String — The attribute value.

See also

getAttributes()method 
public function getAttributes():Object

Since : Reactor 1.0.0

Returns an object whose variables represent the names and values of the shared attributes for this snapshot's room. For details and examples, see the Room class's getAttributes() method, which returns an object of the same format.

Returns
Object

See also

getNumObservers()method 
public function getNumObservers():int

Since : Reactor 1.0.0

Returns the number of observers in the room represented by this snapshot.

Returns
int
getNumOccupants()method 
public function getNumOccupants():int

Since : Reactor 1.0.0

Returns the number of occupants in the room represented by this snapshot.

Returns
int
getObserver()method 
public function getObserver(clientID:String):ClientManifest

Since : Reactor 1.0.0

Returns a ClientManifest object representing the room observer specified by clientID.

Parameters

clientID:String

Returns
ClientManifest

See also

getObservers()method 
public function getObservers():Array

Since : Reactor 1.0.0

Returns a list of the clients observing the room represented by this snapshot. Each item in the list is a string clientID.

Returns
Array
getOccupant()method 
public function getOccupant(clientID:String):ClientManifest

Since : Reactor 1.0.0

Returns a ClientManifest object representing the room occupant specified by clientID.

Parameters

clientID:String

Returns
ClientManifest

See also

getOccupants()method 
public function getOccupants():Array

Since : Reactor 1.0.0

Returns a list of the clients in the room represented by this snapshot. Each item in the list is a string clientID.

Returns
Array
getRoomID()method 
public function getRoomID():String

Since : Reactor 1.0.0

Returns the fully qualified roomID for this room snapshot object.

Returns
String — A string roomID.

See also