Event |
SFSEvent |
Each event dispatched by the SmartFoxClient class is a SFSEvent object (it.gotoandplay.smartfoxserver.SFSEvent) which extends the flash.events.Event class. The SFSEvent class provides a public property called params of type Object that can contain any number of parameters.
package sfsTest
{
import it.gotoandplay.smartfoxserver.SmartFoxClient
import it.gotoandplay.smartfoxserver.SFSEvent
public class MyTest
{
private var smartFox:SmartFoxClient
public function MyTest()
{
// Create instance
smartFox = new SmartFoxClient()
// Add event handler for connection
smartFox.addEventListener(SFSEvent.onConnection, myOnConnectionHandler)
// Connect to server
smartFox.connect("127.0.0.1", 9339)
}
// Handle connection event
public function myOnConnectionHandler(evt:SFSEvent):void
{
if (evt.params.success)
{
trace("Great, successfully connected")
}
else
{
trace("Ouch, connection failed.")
}
}
}
}
1.0.5
Final
The gotoAndPlay() Team
© 2006-2007 gotoAndPlay()
Each event dispatched by the SmartFoxClient class is a SFSEvent object (it.gotoandplay.smartfoxserver.SFSEvent) which extends the flash.events.Event class. | |
Dispatched when a message from the Administrator is received. | |
Dispatched when the buddy list is received. | |
Dispatched when an error occurs while loading the buddy list. | |
Dispatched when the status of a buddy in the buddy list changes. | |
Dispatched in response to a SmartFoxClient.getBuddyRoom request. | |
Dispatched when the connection with SmartFoxServer is lost. | |
Dispatched when an error occurs during the creation of a room. | |
Dispatched when the connection to SmartFoxServer succeeded or failed. | |
Dispatched when a debug message is traced by the SmartFoxServer API. | |
Dispatched when a response from a server-side extension is received. | |
Dispatched when a room is joined successfully. | |
Dispatched when an error occurs while joining a room. | |
Dispatched after the login to SmartFoxServer has been attempted. | |
Dispatched after the user logged out successfully. | |
Dispatched when a message from a Moderator is received. | |
Dispatched when an Actionscript object is received. | |
Dispatched when a public message is received. | |
Dispatched when a private message is received. | |
Dispatched when a response to the SmartFoxClient.getRandomKey request is received. | |
Dispatched when a new room is created. | |
Dispatched when a room is removed. | |
Dispatched when a room is left in multi-room mode, in response of a SmartFoxClient.leaveRoom request. | |
Dispatched when the list of rooms available in the Zone is received. | |
Dispatched when room variables are updated in a certain room. | |
Dispatched when a response to the SmartFoxClient.roundTripBench request is received. | |
Dispatched when a response to the SmartFoxClient.switchSpectator request is received. | |
Dispatched when the user/spectator count of a room changed. | |
Dispatched when a user joins the current room. | |
Dispatched when a user leaves the current room. | |
Dispatched when a user updates his/her User Variables. | |
Contains the parameters passed by the SmartFoxClient class. | |
The default contructor. | |
Create and returns a copy of the current instance. | |
Return a String containing all the properties of the current instance. |
Dispatched when a message from the Administrator is received.
Admin messages are special messages that can be sent by an administrator to a user or group of users. All client applications should handle this event, or users won’t be be able to receive important admin notifications!
The params object contains the following parameters.
Dispatched when the buddy list is received.
The params object contains the following parameters.
Each element in the buddy list is an object containing the following parameters.
Dispatched when an error occurs while loading the buddy list.
The params object contains the following parameters.
Dispatched when the status of a buddy in the buddy list changes.
The params object contains the following parameters.
The buddy object contains the following parameters.
Dispatched in response to a SmartFoxClient.getBuddyRoom request.
The params object contains the following parameters.
Dispatched when an error occurs during the creation of a room.
Usually this happens when a client tries to create a room but its name is already taken.
The params object contains the following parameters.
Dispatched when the connection to SmartFoxServer succeeded or failed.
The params object contains the following parameters.
Dispatched when a debug message is traced by the SmartFoxServer API.
In order to receive this event you have to previously set the SmartFoxClient.debug flag to true.
The params object contains the following parameters.
Dispatched when a response from a server-side extension is received.
The params object contains the following parameters.
Dispatched when an error occurs while joining a room.
This can happen, for example, when the room you want to join is full.
The params object contains the following parameters.
Dispatched after the login to SmartFoxServer has been attempted.
The params object contains the following parameters.
The response object contains the following parameters.
Dispatched when a private message is received.
The params object contains the following parameters.
Dispatched when a response to the SmartFoxClient.getRandomKey request is received.
The params object contains the following parameters.
Dispatched when a room is left in multi-room mode, in response of a SmartFoxClient.leaveRoom request.
The params object contains the following parameters.
Dispatched when room variables are updated in a certain room.
A client receives these notifications only from the room(s) where he is currently logged in. Also, only the variables that changed are transmitted.
The params object contains the following parameters.
Dispatched when a response to the SmartFoxClient.roundTripBench request is received.
The params object contains the following parameters.
Dispatched when a response to the SmartFoxClient.switchSpectator request is received.
The params object contains the following parameters.
Dispatched when a user leaves the current room.
The params object contains the following parameters.
Dispatched when a user updates his/her User Variables.
The params object contains the following parameters.
Request the roomId(s) of the room(s) a buddy is currently joined to.
public function getBuddyRoom( buddy: Object ):void
Gets a random string key from the server.
public function getRandomKey():void
Disconnect the user from the specified room.
public function leaveRoom( roomId: int ):void
Send a roundTrip request to the server to test the speed of the connection.
public function roundTripBench():void
Turn a spectator inside a game room into a player.
public function switchSpectator( roomId: int = -1 ):void
Contains the parameters passed by the SmartFoxClient class.
public var params: Object
The default contructor.
public function SFSEvent( type: String, params: Object )
Create and returns a copy of the current instance.
function clone():Event
Return a String containing all the properties of the current instance.
function toString():String
Toggles the client-side debugging informations.
public var debug: Boolean