Packagenet.user1.reactor.snapshot
Classpublic class AccountSnapshot
InheritanceAccountSnapshot Inheritance Snapshot Inheritance flash.events.EventDispatcher

Since : Reactor 1.0.0

The AccountSnapshot class is used to load a "snapshot" of a server-side user account. The snapshot includes all persistent attributes stored in the user account, including room attributes and global attributes. For example, the following code retrieves a snapshot for the account with the userID "Bob".
   // Create the snapshot
   var snapshot:AccountSnapshot = new AccountSnapshot("Bob");
   
   // Register a callback function
   snapshot.onLoad = function ():void { 
     // Display the user's global "highScore" attribute
     trace(snapshot.getAttribute("highScore"));
   }
   
   // Or register a listener function
   snapshot.addEventListener(SnapshotEvent.LOAD, loadListener);
   function loadListener (e:SnapshotEvent):void {
     // Display the user's global "highScore" attribute
     trace(snapshot.getAttribute("highScore"));
   }
   
   // Load the account'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
  
AccountSnapshot(userID:String)
AccountSnapshot
  
getAttribute(name:String, scope:String = null):String
Returns the value of the specified account attribute.
AccountSnapshot
  
getAttributes():Object
Returns an object whose variables represent the names and values of the shared attributes for this snapshot's account.
AccountSnapshot
 Inherited
getStatus():String
Returns the status of the most recent snapshot load-operation.
Snapshot
  
getUserID():String
Returns the userID for this user account snapshot object.
AccountSnapshot
 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
AccountSnapshot()Constructor
public function AccountSnapshot(userID:String)



Parameters
userID: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 account attribute.

Parameters

name:String — The attribute's name.
 
scope:String (default = null) — The attribute's scope. For global account 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 account. 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

getUserID()method 
public function getUserID():String

Since : Reactor 1.0.0

Returns the userID for this user account snapshot object.

Returns
String — A string userID.

See also