A simple message
Posted: 01 May 2010, 21:57
Hi, I was just wondering, does the sendPriavteMessage function trigger the onPrivateMessage eventhandler on both sender and receiver?
I try this code, which basicly is the same as in the docs:
Now, while this does work, there is a small problem.The trace from the onPrivateMessageHandler is traced twice. The trace in btnInvitePlayerClick does however not.
I try this code, which basicly is the same as in the docs:
Code: Select all
btnInvitePlayer.addEventListener(MouseEvent.CLICK,btnInvitePlayerClick)
smartfox.addEventListener(SFSEvent.onPrivateMessage, onPrivateMessageHandler);
}
private function btnInvitePlayerClick(e:Event)
{
if(lstPlayers.selectedItem!=null)
{
trace(lstPlayers.selectedItem.data);
smartfox.sendPrivateMessage("test msg",lstPlayers.selectedItem.data);
}
else
{
trace("please select a player")
}
}
private function onPrivateMessageHandler(e:SFSEvent)
{
trace("User " + e.params.sender.getName() + " sent the following private message: " + e.params.message)
}