Packagenet.user1.reactor
Classpublic class Attribute
InheritanceAttribute Inheritance Object

Since : Reactor 1.0.0

A simple data class representing an attribute of a client, a room, or a user account. Attribute instances represent a changed or deleted attribute, and are passed to event listeners for the following events: AttributeEvent.UPDATE, AttributeEvent.DELETE, RoomEvent.UPDATE_CLIENT_ATTRIBUTE, RoomEvent.DELETE_CLIENT_ATTRIBUTE.

View the examples

See also

RoomEvent.getChangedAttr()
AttributeEvent.getChangedAttr()


Public Variables
 VariableDefined By
  byClient : IClient
The IClient object representing the client that set or deleted the attribute, if known.
Attribute
  name : String
The attribute name.
Attribute
  oldValue : String
The attribute's old value.
Attribute
  scope : String
The attribute's qualifying room ID.
Attribute
  value : String
The attribute value.
Attribute
Public Methods
 MethodDefined By
  
Attribute(name:String, value:String, oldValue:String, scope:String = null, byClient:IClient = null)
Constructor.
Attribute
  
toString():String
A string representation of the attribute.
Attribute
Variable Descriptions
byClientvariable
public var byClient:IClient

Since : Reactor 1.0.0

The IClient object representing the client that set or deleted the attribute, if known. When the server sets an attribute, byClient is null.

namevariable 
public var name:String

Since : Reactor 1.0.0

The attribute name.

oldValuevariable 
public var oldValue:String

Since : Reactor 1.0.0

The attribute's old value.

scopevariable 
public var scope:String

Since : Reactor 1.0.0

The attribute's qualifying room ID. Applies to client attributes only. Room attributes and global client attributes have the scope null.

valuevariable 
public var value:String

Since : Reactor 1.0.0

The attribute value.

Constructor Description
Attribute()Constructor
public function Attribute(name:String, value:String, oldValue:String, scope:String = null, byClient:IClient = null)

Constructor.

Parameters
name:String
 
value:String
 
oldValue:String
 
scope:String (default = null)
 
byClient:IClient (default = null)
Method Descriptions
toString()method
public function toString():String

Since : Reactor 1.0.0

A string representation of the attribute.

Returns
String
Examples
The following code shows a RoomEvent.UPDATE_CLIENT_ATTRIBUTE listener that uses an Attribute object to manage the display of "moods" in a chat application.
   protected function updateClientAttributeListener (e:RoomEvent):void {
     // Use getChangedAttribute() to retrieve the Attribute object.
     // If the changed attribute's name is "MOOD", display the
     // new mood.
     if (e.getChangedAttr().name == "MOOD") {
       trace("User " + e.getClient().getClientID() 
             + " has a new mood: " + e.getChangedAttr().value; 
       }
     }
   }