Main Page | Packages | Class Tree | Index

it.gotoandplay.smartfoxbits.events

class SFSEvent

Object
  |
  +--it.gotoandplay.smartfoxbits.events.BaseEvent
        |
        +--it.gotoandplay.smartfoxbits.events.SFSEvent


class SFSEvent
extends BaseEvent

The SFSEvent class is the base class for all the event objects dispatched by the SmartFoxBits components, passed as parameters to event listeners when an event occurs.

The SFSEvent class provides the public property params that can contain any number of parameters.

Usage:
Refer to the SmartFoxBits' component addEventListener method for usage examples.


Author:

Version:
1.0.0

Since:
SmartFoxBits v1.0

See also:


Field Summary

public static
onAdminMessage: String
Dispatched when a message from the Administrator is received.

public static
onBuddyList: String
Dispatched when the buddy list is received.

public static
onBuddyListError: String
Dispatched when an error occurs while loading the buddy list.

public static
onBuddyListUpdate: String
Dispatched when the status of a buddy in the buddy list changes.

public static
onBuddyRoom: String
Dispatched when a response to the SmartFoxClient.getBuddyRoom() request is received.

public static
onConnection: String
Dispatched when the connection to SmartFoxServer succeeded or failed.

public static
onConnectionLost: String
Dispatched when the connection with SmartFoxServer is lost.

public static
onCreateRoomError: String
Dispatched when an error occurs during the creation of a room.

public static
onDebugMessage: String
Dispatched when a debug message is traced by the SmartFoxServer API.

public static
onExtensionResponse: String
Dispatched when a response from a server-side extension is received.

public static
onJoinRoom: String
Dispatched when a room is joined successfully.

public static
onJoinRoomError: String
Dispatched when an error occurs while joining a room.

public static
onLogin: String
Dispatched after the login to SmartFoxServer has been attempted.

public static
onLogout: String
Dispatched after the user logged out successfully.

public static
onModeratorMessage: String
Dispatched when a message from a Moderator is received.

public static
onObjectReceived: String
Dispatched when an Actionscript object is received.

public static
onPrivateMessage: String
Dispatched when a private message is received.

public static
onPublicMessage: String
Dispatched when a public message is received.

public static
onRandomKey: String
Dispatched when a response to the SmartFoxClient.getRandomKey() request is received.

public static
onRoomAdded: String
Dispatched when a new room is created.

public static
onRoomDeleted: String
Dispatched when a room is removed.

public static
onRoomLeft: String
Dispatched when a room is left in multi-room mode, in response of a SmartFoxClient.leaveRoom() request.

public static
onRoomListUpdate: String
Dispatched when the list of rooms available in the Zone is received.

public static
onRoomVariablesUpdate: String
Dispatched when room variables are updated in a certain room.

public static
onRoundTripResponse: String
Dispatched when a response to the SmartFoxClient.roundTripBench() request is received.

public static
onSpectatorSwitched: String
Dispatched when a response to the SmartFoxClient.switchSpectator() request is received.

public static
onUserCountChange: String
Dispatched when the user/spectator count of a room changed.

public static
onUserEnterRoom: String
Dispatched when a user joins the current room.

public static
onUserLeaveRoom: String
Dispatched when a user leaves the current room.

public static
onUserVariablesUpdate: String
Dispatched when a user updates his/her User Variables.

Property Summary

public
params: Object (read, write)
Object containing the parameters passed by the event.

Properties inherited from class it.gotoandplay.smartfoxbits.events.BaseEvent

target, type

Constructor


SFSEvent ( target: Object, type: String)
SFSEvent class constructor.

Method Summary

public static
createNewEvent ( type: String, args: Array, target: Object ): SFSEvent
Dynamically create an SFSEvent from an old-style SmartFoxServer event.



Field Documentation

onAdminMessage

public static var onAdminMessage: String
Dispatched when a message from the Administrator is received.

The params object contains the following parameters:

  • message:String
    The Administrator's message.

onBuddyList

public static var onBuddyList: String
Dispatched when the buddy list is received.

The params object contains the following parameters:

  • list:Array
    The buddy list; each element in the array is an object containing the following parameters:
    • id:Number
      The buddy ID.
    • name:String
      The buddy name.
    • isOnline:Boolean
      The buddy status: true if the buddy is online; false if the buddy is offline.
    • variables:Object
      An object with extra properties of the buddy.

onBuddyListError

public static var onBuddyListError: String
Dispatched when an error occurs while loading the buddy list.

The params object contains the following parameters:

  • error:String
    The error message.

onBuddyListUpdate

public static var onBuddyListUpdate: String
Dispatched when the status of a buddy in the buddy list changes.

The params object contains the following parameters:

  • buddy:Object
    An object representing the buddy that has changed status. It contains the following parameters:
    • id:Number
      The buddy ID.
    • name:String
      The buddy name.
    • isOnline:Boolean
      The buddy status: true if the buddy is online; false if the buddy is offline.
    • variables:Object
      An object with extra properties of the buddy.

onBuddyRoom

public static var onBuddyRoom: String
Dispatched when a response to the SmartFoxClient.getBuddyRoom() request is received.

The params object contains the following parameters:

  • idList:Array
    An array containing the id(s) of the rooms in which the buddy is currently logged.

onConnection

public static var onConnection: String
Dispatched when the connection to SmartFoxServer succeeded or failed.

The params object contains the following parameters:

  • success:Boolean
    The connection result: true if the connection succeeded; false if the connection failed.
  • error:String
    An error message if connection failed.

onConnectionLost

public static var onConnectionLost: String
Dispatched when the connection with SmartFoxServer is lost.

No parameters are available.

onCreateRoomError

public static var onCreateRoomError: String
Dispatched when an error occurs during the creation of a room.

The params object contains the following parameters:

  • error:String
    The error message.

onDebugMessage

public static var onDebugMessage: String
Dispatched when a debug message is traced by the SmartFoxServer API.

The params object contains the following parameters:

  • message:String
    The debug message.
In order to receive this event you have to previously set the debug flag in the Connector component to true.

onExtensionResponse

public static var onExtensionResponse: String
Dispatched when a response from a server-side extension is received.

The params object contains the following parameters:

  • dataObj:Object
    The response object.
  • type:String
    The response protocol type: can be either "xml", "str" or "json"; by default "xml" is used.

onJoinRoom

public static var onJoinRoom: String
Dispatched when a room is joined successfully.

The params object contains the following parameters:

  • room:Room
    The Room object representing the joined room.

onJoinRoomError

public static var onJoinRoomError: String
Dispatched when an error occurs while joining a room.

The params object contains the following parameters:

  • error:String
    The error message.

onLogin

public static var onLogin: String
Dispatched after the login to SmartFoxServer has been attempted.

The params object contains the following parameters:

  • resObj:Object
    The response object sent by the server, containing the following parameters:
    • success:Boolean
      The login result: true if the login was successful; false if login failed. The reason for failure is explained in the error parameter.
    • name:String
      Your current username.
      NOTE: the server sends the username back to the client because not all usernames are valid (for example those containing bad words may have been filtered).
    • error:String
      If login fails, this parameter contains the error description sent by the server.

onLogout

public static var onLogout: String
Dispatched after the user logged out successfully.

No parameters are available.

onModeratorMessage

public static var onModeratorMessage: String
Dispatched when a message from a Moderator is received.

The params object contains the following parameters:

  • message:String
    The Administrator's message.
  • sender:User
    The User object representing the user that sent the message.

onObjectReceived

public static var onObjectReceived: String
Dispatched when an Actionscript object is received.

The params object contains the following parameters:

  • obj:Object
    The Actionscript object received.
  • sender:User
    The User object representing the user that sent the Actionscript object.

onPrivateMessage

public static var onPrivateMessage: String
Dispatched when a private message is received.

The params object contains the following parameters:

  • message:String
    The private message received.
  • sender:User
    The User object representing the user that sent the private message: this property is undefined if the sender isn't in the same room of the recipient.
  • userId:Number
    The user ID of the sender.
  • roomId:Number
    The ID of the room the sender is inside.

onPublicMessage

public static var onPublicMessage: String
Dispatched when a public message is received.

The params object contains the following parameters:

  • message:String
    The public message received.
  • sender:User
    The User object representing the user that sent the public message.
  • roomId:Number
    The ID of the room the sender is inside.

onRandomKey

public static var onRandomKey: String
Dispatched when a response to the SmartFoxClient.getRandomKey() request is received.

The params object contains the following parameters:

  • key:String
    The unique random key generated by the server.

onRoomAdded

public static var onRoomAdded: String
Dispatched when a new room is created.

The params object contains the following parameters:

  • room:Room
    The Room object representing the room that was created.

onRoomDeleted

public static var onRoomDeleted: String
Dispatched when a room is removed.

The params object contains the following parameters:

  • room:Room
    The Room object representing the room that was removed.

onRoomLeft

public static var onRoomLeft: String
Dispatched when a room is left in multi-room mode, in response of a SmartFoxClient.leaveRoom() request.

The params object contains the following parameters:

  • roomId:Number
    The ID of the room that was left.

onRoomListUpdate

public static var onRoomListUpdate: String
Dispatched when the list of rooms available in the Zone is received.

The params object contains the following parameters:

  • roomList:Array
    The list of Room objects available in the Zone.

onRoomVariablesUpdate

public static var onRoomVariablesUpdate: String
Dispatched when room variables are updated in a certain room.

A client receives these notifications only from the room(s) where he/she is currently logged in. Also, only the variables that changed are transmitted.

The params object contains the following parameters:

  • room:Room
    The Room object representing the room where the update took place.
  • changedVars:Array
    An associative array with the names of the changed variables as keys. You can also iterate through numeric indexes (0 to length) to get the names of the variables that changed.

onRoundTripResponse

public static var onRoundTripResponse: String
Dispatched when a response to the SmartFoxClient.roundTripBench() request is received.

The params object contains the following parameters:

  • elapsed:Number
    The amount of milliseconds that it takes to a message to go from the client to the server and back to the client.

onSpectatorSwitched

public static var onSpectatorSwitched: String
Dispatched when a response to the SmartFoxClient.switchSpectator() request is received.

The params object contains the following parameters:

  • success:Boolean
    The switch result: true if the spectator was turned into a player, otherwise false.
  • newId:Number
    The new player ID of the user (all spectators have their playerId property set to -1).
  • room:Room
    The Room object representing the room where the switch occurred.

onUserCountChange

public static var onUserCountChange: String
Dispatched when the user/spectator count of a room changed.

The params object contains the following parameters:

  • room:Room
    The Room object representing the room where the change occurred.

onUserEnterRoom

public static var onUserEnterRoom: String
Dispatched when a user joins the current room.

The params object contains the following parameters:

  • roomId:Number
    The ID of the room joined by a user.
  • user:User
    The User object representing the user that joined the room.

onUserLeaveRoom

public static var onUserLeaveRoom: String
Dispatched when a user leaves the current room.

The params object contains the following parameters:

  • roomId:Number
    The ID of the room left by the user.
  • userId:Number
    The ID of the user that left the room (or got disconnected).
  • userName:String
    The name of the user that left the room.

onUserVariablesUpdate

public static var onUserVariablesUpdate: String
Dispatched when a user updates his/her User Variables.

The params object contains the following parameters:

  • user:User
    The User object representing the user changing his/her variables.
  • changedVars:Array
    An associative array with the names of the changed variables as keys. You can also iterate through numeric indexes (0 to length) to get the names of the variables that changed.


Property Documentation

params

public params: Object (read, write)
Object containing the parameters passed by the event.

Value:
The event parameters.


Constructor Documentation

SFSEvent

function SFSEvent(target: Object,
 type: String)
SFSEvent class constructor.

See also:


Method Documentation

createNewEvent

public static function createNewEvent(type: String,
 args: Array,
 target: Object): SFSEvent
Dynamically create an SFSEvent from an old-style SmartFoxServer event.

Parameters:
type
type of the event
args
event arguments
target
the target event sender
Returns:
the SFSEvent


The documentation was generated from the following file: