| Package | com.smartfoxserver.v2.requests |
| Class | public class LeaveRoomRequest |
| Inheritance | LeaveRoomRequest com.smartfoxserver.v2.requests.BaseRequest |
Depending on the Room configuration defined upon its creation (see the RoomSettings.events setting), when the current user leaves it, the following events might be fired: userExitRoom, dispatched to all the users inside the Room (including the current user then) to warn them that a user has gone away; userCountChange, dispatched to all clients which subscribed the Group to which the Room belongs, to update the count of users inside the Room.
See also
| Method | Defined By | ||
|---|---|---|---|
LeaveRoomRequest(theRoom:Room = null)
Creates a new LeaveRoomRequest instance. | LeaveRoomRequest | ||
| LeaveRoomRequest | () | Constructor |
public function LeaveRoomRequest(theRoom:Room = null)Creates a new LeaveRoomRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
ParameterstheRoom:Room (default = null) — The Room object corresponding to the Room that the current user must leave. If null, the last Room joined by the user is left.
|
See also
private function someMethod():void
{
sfs.addEventListener(SFSEvent.USER_EXIT_ROOM, onUserExitRoom);
// Leave the last joined Room
sfs.send(new LeaveRoomRequest());
}
private function onUserExitRoom(evt:SFSEvent):void
{
var room:Room = evt.params.room;
var user:User = evt.params.user;
trace("User " + user.name + " just left Room " + room.name);
}