Packagenet.user1.reactor.snapshot
Classpublic class ClientSnapshot
InheritanceClientSnapshot Inheritance Snapshot Inheritance flash.events.EventDispatcher

Since : Reactor 1.0.0

The ClientSnapshot class is used to load a "snapshot" of a client on the server. The snapshot includes all of the client's attributes, a list of the rooms the client is in, and a list of rooms the client is observing. If the client is currently logged in under a user account, the snapshot also includes the userID for that account. For example, the following code retrieves a snapshot of the client with clientID "1". If the client with clientID "1" is no longer on the server, the snapshot triggers a SnapshotEvent.STATUS event with the status Status.CLIENT_NOT_FOUND.
   // Create the snapshot
   var snapshot:ClientSnapshot = new ClientSnapshot("1");
   
   // Register a callback function
   snapshot.onLoad = function ():void { 
     // Display the list of rooms the client is in
     trace(snapshot.getOccupiedRoomIDs());
   }
   
   // Or register a listener function
   snapshot.addEventListener(SnapshotEvent.LOAD, loadListener);
   function loadListener (e:SnapshotEvent):void {
     // Display the list of rooms the client is in
     trace(ClientSnapshot(e.target).getOccupiedRoomIDs());
   }
   
   // Register a listener function for status updates
   snapshot.addEventListener(SnapshotEvent.STATUS, statusListener);
   function statusListener (e:SnapshotEvent):void {
     trace("Client snapshot load status: " + ClientSnapshot(e.target).getStatus());
   }
   
   // Load the client's data by passing the snapshot object to 
   // Reactor's updateSnapshot() method:
   reactor.updateSnapshot(snapshot);
   

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
  
ClientSnapshot(clientID:String)
ClientSnapshot
  
getAttribute(name:String, scope:String = null):String
Returns the value of the specified client attribute.
ClientSnapshot
  
getAttributes():Object
Returns an object whose variables represent the names and values of the shared attributes for this snapshot's client.
ClientSnapshot
  
getClientID():String
Returns the clientID for this client snapshot object.
ClientSnapshot
  
Returns a list of the rooms observed by the client represented by this snapshot.
ClientSnapshot
  
Returns a list of the rooms containing the client represented by this snapshot.
ClientSnapshot
 Inherited
getStatus():String
Returns the status of the most recent snapshot load-operation.
Snapshot
  
getUserID():String
If the client represented by this snapshot object is logged in under a user account, getUserID() returns that account; otherwise, getUserID() returns null.
ClientSnapshot
 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
ClientSnapshot()Constructor
public function ClientSnapshot(clientID:String)



Parameters
clientID:String
Method Descriptions
getAttribute()method
public function getAttribute(name:String, scope:String = null):String

Since : Reactor 1.0.0

Returns the value of the specified client attribute.

Parameters

name:String — The attribute's name.
 
scope:String (default = null) — The attribute's scope. For global client attributes, specify scope null. For attributes scoped to a room, specify the room's id.

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 client. The object is a map of fully qualified attribute name/value pairs. For details and examples, see the Client class's getAttributes() method, which returns an object of the same format.

Returns
Object

See also

getClientID()method 
public function getClientID():String

Since : Reactor 1.0.0

Returns the clientID for this client snapshot object.

Returns
String — A string clientID.

See also

getObservedRoomIDs()method 
public function getObservedRoomIDs():Array

Since : Reactor 1.0.0

Returns a list of the rooms observed by the client represented by this snapshot. Each item in the list a fully qualified string roomID.

Returns
Array
getOccupiedRoomIDs()method 
public function getOccupiedRoomIDs():Array

Since : Reactor 1.0.0

Returns a list of the rooms containing the client represented by this snapshot. Each item in the list a fully qualified string roomID.

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

Since : Reactor 1.0.0

If the client represented by this snapshot object is logged in under a user account, getUserID() returns that account; otherwise, getUserID() returns null.

Returns
String — A string userID.

See also