| Package | com.electrotank.electroserver4.message.request |
| Class | public class PrivateMessageRequest |
| Inheritance | PrivateMessageRequest com.electrotank.electroserver4.message.request.RequestImpl |
import com.electrotank.electroserver4.ElectroServer;
import com.electrotank.electroserver4.message.MessageType;
import com.electrotank.electroserver4.message.request.
import com.electrotank.electroserver4.message.response.
import com.electrotank.electroserver4.message.event.
private var es:ElectroServer;
function init():void {
es.addEventListener(MessageType.PrivateMessageEvent, "onPrivateMessageEvent", this);
}
function sendPrivateMessage(message:String, userName:String):void {
//build the request
var pmr:PrivateMessageRequest = new PrivateMessageRequest();
pmr.setMessage(message);
pmr.setUserNames([userName]);
//send it
es.send(pmr);
}
function onPrivateMessageEvent(e:PrivateMessageEvent):void {
var from:String = e.getUserName();
var message:String = e.getMessage();
trace(from+": "+message);
}
init();
sendPrivateMessage("Hello world", ["fluffy323"]);
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new instance of the PrivateMessageRequest class.
| PrivateMessageRequest | ||
|
Returns the optional EsObject.
| PrivateMessageRequest | ||
|
getMessage():String
Returns the message text to be sent.
| PrivateMessageRequest | ||
|
getUserNames():Array
Returns the list of user names to whom this message will be sent.
| PrivateMessageRequest | ||
|
getUsers():Array
Returns the list of users to whom this message will be sent.
| PrivateMessageRequest | ||
|
setEsObject(eob:EsObject):void
Sets the optional EsObject that will be sent along with this message.
| PrivateMessageRequest | ||
|
setMessage(message:String):void
Sets the message text to be sent.
| PrivateMessageRequest | ||
|
setUserNames(names:Array):void
An array of user names of the users to whom the message will be sent.
| PrivateMessageRequest | ||
|
setUsers(users:Array):void
Sets the list of users to whom this message will be sent.
| PrivateMessageRequest | ||
| PrivateMessageRequest | |||
| PrivateMessageRequest | () | constructor |
public function PrivateMessageRequest()Creates a new instance of the PrivateMessageRequest class.
| getEsObject | () | method |
public function getEsObject():EsObjectReturns the optional EsObject.
ReturnsEsObject —
Returns the optional EsObject.
|
| getMessage | () | method |
public function getMessage():StringReturns the message text to be sent.
ReturnsString — Returns the message text to be sent.
|
| getUserNames | () | method |
public function getUserNames():ArrayReturns the list of user names to whom this message will be sent.
ReturnsArray — Returns the list of user names to whom this message will be sent.
|
| getUsers | () | method |
public function getUsers():ArrayReturns the list of users to whom this message will be sent.
ReturnsArray — Returns the list of users to whom this message will be sent.
|
| setEsObject | () | method |
public function setEsObject(eob:EsObject):voidSets the optional EsObject that will be sent along with this message.
Parameterseob:EsObject — The optional EsObject that will be sent along with this message.
|
| setMessage | () | method |
public function setMessage(message:String):voidSets the message text to be sent.
Parametersmessage:String — The message text to be sent.
|
| setUserNames | () | method |
public function setUserNames(names:Array):voidAn array of user names of the users to whom the message will be sent.
Parametersnames:Array — An array of user names of the users to whom the message will be sent.
|
| setUsers | () | method |
public function setUsers(users:Array):voidSets the list of users to whom this message will be sent.
Parametersusers:Array — The list of users to whom this message will be sent.
|
| validate | () | method |