Packagecom.smartfoxserver.v2.entities.variables
Classpublic class SFSRoomVariable
InheritanceSFSRoomVariable Inheritance BaseVariable Inheritance Object
Implements RoomVariable

The SFSRoomVariable object represents a SmartFoxServer Room Variable entity on the client. It is a custom value attached to a Room object that gets automatically synchronized between client and server on every change.

Room Variables are particularly useful to store custom Room data such as a game status and other Room-level informations. Room Variables can be set by means of the SetRoomVariablesRequest request; they support the following data types (also nested): Boolean, int, Number, String, SFSObject, SFSArray. A Room Variable can also be null.

Room Variables also support a number of specific flags:

See also

Room
SetRoomVariablesRequest


Public Properties
 PropertyDefined By
  isPersistent : Boolean
Indicates whether this Room Variable is persistent or not.
SFSRoomVariable
  isPrivate : Boolean
Indicates whether this Room Variable is private or not.
SFSRoomVariable
 Inheritedname : String
[read-only] Indicates the name of this variable.
BaseVariable
 Inheritedtype : String
[read-only] Indicates the type of this variable.
BaseVariable
Public Methods
 MethodDefined By
  
SFSRoomVariable(name:String, value:*, type:int = -1)
Creates a new SFSRoomVariable instance.
SFSRoomVariable
 Inherited
getBoolValue():Boolean
Retrieves the value of a boolean variable.
BaseVariable
 Inherited
Retrieves the value of a numeric variable.
BaseVariable
 Inherited
Retrieves the value of an integer variable.
BaseVariable
 Inherited
Retrieves the value of a SFSArray variable.
BaseVariable
 Inherited
Retrieves the value of a SFSObject variable.
BaseVariable
 Inherited
Retrieves the value of a string variable.
BaseVariable
 Inherited
Retrieves the untyped value of this variable.
BaseVariable
 Inherited
isNull():Boolean
Indicates if the variable is null.
BaseVariable
  
toString():String
Returns a string that contains the Room Variable name, type, value and isPrivate flag.
SFSRoomVariable
Property Detail
isPersistentproperty
isPersistent:Boolean

Indicates whether this Room Variable is persistent or not. A persistent Room Variable continues to exist in the Room after the user who created it has left it and until he disconnects.

NOTE: setting the isPersistent property manually on an existing Room Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the Room Variable object is created by the developer only (using the new keyword).


Implementation
    public function get isPersistent():Boolean
    public function set isPersistent(value:Boolean):void
isPrivateproperty 
isPrivate:Boolean

Indicates whether this Room Variable is private or not. A private Room Variable is visible to all users in the same Room, but it can be modified only by its owner (the user that created it).

NOTE: setting the isPrivate property manually on an existing Room Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the Room Variable object is created by the developer only (using the new keyword).


Implementation
    public function get isPrivate():Boolean
    public function set isPrivate(value:Boolean):void
Constructor Detail
SFSRoomVariable()Constructor
public function SFSRoomVariable(name:String, value:*, type:int = -1)

Creates a new SFSRoomVariable instance.

Parameters
name:String — The name of the Room Variable.
 
value:* — The value of the Room Variable; valid data types are: Boolean, int, Number, String, SFSObject, SFSArray. The value can also be null.
 
type:int (default = -1) — The type of the Room Variable among those available in the VariableType class. Usually it is not necessary to pass this parameter, as the type is auto-detected from the value.

See also

Method Detail
toString()method
public function toString():String

Returns a string that contains the Room Variable name, type, value and isPrivate flag.

Returns
String — The string representation of the SFSRoomVariable object.