Package | com.smartfoxserver.v2.requests |
Class | public class ChangeRoomPasswordStateRequest |
Inheritance | ChangeRoomPasswordStateRequest com.smartfoxserver.v2.requests.BaseRequest |
If the operation is successful, the roomPasswordStateChange event is dispatched to all the users who subscribed the Group to which the target Room belongs, including the requester user himself. If the user is not the creator (owner) of the Room, the roomPasswordStateChangeError 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 password change is not allowed (see the RoomSettings.permissions parameter), the request is ignored and no error is fired.
See also
Method | Defined By | ||
---|---|---|---|
ChangeRoomPasswordStateRequest(room:Room, newPass:String)
Creates a new ChangeRoomPasswordStateRequest instance. | ChangeRoomPasswordStateRequest |
ChangeRoomPasswordStateRequest | () | Constructor |
public function ChangeRoomPasswordStateRequest(room:Room, newPass:String)
Creates a new ChangeRoomPasswordStateRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
Parametersroom:Room — The Room object corresponding to the Room whose password should be changed.
| |
newPass:String — The new password to be assigned to the Room; an empty string or the null value can be passed to remove the Room's password.
|
See also
private function someMethod():void { sfs.addEventListener(SFSEvent.ROOM_PASSWORD_STATE_CHANGE, onRoomPasswordStateChanged); sfs.addEventListener(SFSEvent.ROOM_PASSWORD_STATE_CHANGE_ERROR, onRoomPasswordStateChangeError); var theRoom:Room = sfs.getRoomByName("Gonzo's Room"); sfs.send(new ChangeRoomPasswordStateRequest(theRoom, "mammamia")); } private function onRoomPasswordStateChanged(evt:SFSEvent):void { trace("The password of Room " + evt.params.room.name + " was changed successfully"); } private function onRoomPasswordStateChangeError(evt:SFSEvent):void { trace("Room password change failed: " + evt.params.errorMessage); }