privateMessage and receiver

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
gsources75
Posts: 8
Joined: 06 Sep 2010, 21:37

privateMessage and receiver

Post by gsources75 »

Ok i write an example.

There are 2 user in room.

fox1 and fox2. I'm fox1.

i send a private message.

smartFox.sendPrivateMessage("ciao",id, room);

ok it works but on event

private function onPrivateMessage(event : SFSEvent) : void {

i can know only sender i know "from" and not "to".

i test here, all users receive identic message.

fox1 send a private message.

Iis it correct ?

is there a method to know the receiver ?
TiagoR
Posts: 83
Joined: 15 Mar 2010, 11:42
Location: Portugal

Post by TiagoR »

Code: Select all

smartFox.sendPrivateMessage (message, recipientId, roomId)

// message (String) : the text of the private message.
// recipientId (int) : the id of the recipient user.
// roomId (int): the id of the room from where the message is sent, in case of multi-room join (optional, default value: activeRoomId).

Code: Select all

function onPrivateMessage(evt:SFSEvent):void
{
    trace("User " + evt.params.sender.getName() + " sent the following private message: " + evt.params.message)
}
Traces the user that sent the message and the message text. The only one that receives the message is the recipientId user. All others users dont. So there is no need for a method to know the receiver, since its only him that receives.
TR
Post Reply