Packagecom.smartfoxserver.v2.requests
Classpublic class ChangeRoomNameRequest
InheritanceChangeRoomNameRequest Inheritance com.smartfoxserver.v2.requests.BaseRequest

Changes the name of a Room.

If the renaming operation is successful, the roomNameChange event is dispatched to all the users who subscribed the Group to which the target Room belongs, including the user who renamed it. If the user is not the creator (owner) of the Room, or if the Room was configured so that renaming is not allowed (see the RoomSettings.permissions parameter), the roomNameChangeError event is fired. An administrator or moderator can override the first constrain (he is not requested to be the Room's owner).

If the user is not the creator (owner) of the Room, or if the new name doesn't match the related criteria in Zone configuration, the roomNameChangeError event is fired. An administrator or moderator can override this constrain (he is not requested to be the Room's owner).

If the Room was configured so that renaming is not allowed (see the RoomSettings.permissions parameter), the request is ignored and no error is fired.

View the examples

See also

roomNameChange event
roomNameChangeError event
RoomSettings.permissions


Public Methods
 MethodDefined By
  
ChangeRoomNameRequest(room:Room, newName:String)
Creates a new ChangeRoomNameRequest instance.
ChangeRoomNameRequest
Constructor Detail
ChangeRoomNameRequest()Constructor
public function ChangeRoomNameRequest(room:Room, newName:String)

Creates a new ChangeRoomNameRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters
room:Room — The Room object corresponding to the Room whose name should be changed.
 
newName:String — The new name to be assigned to the Room.

See also

Examples
The following example renames an existing Room:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSEvent.ROOM_NAME_CHANGE, onRoomNameChanged);
         sfs.addEventListener(SFSEvent.ROOM_NAME_CHANGE_ERROR, onRoomNameChangeError);
         
         var theRoom:Room = sfs.getRoomByName("Gonzo's Room");
         sfs.send(new ChangeRoomNameRequest(theRoom, "Gonzo The Great's Room"));
     }
     
     private function onRoomNameChanged(evt:SFSEvent):void
     {
         trace("Room " + evt.params.oldName + " was successfully renamed to " + evt.params.room.name);
     }
     
     private function onRoomNameChangeError(evt:SFSEvent):void
     {
         trace("Room name change failed: " + evt.params.errorMessage);
     }