- Code: Select all
private function handleJoin(connection:Connection):void{
trace("Sucessfully connected to the multiplayer server");
tf_connect.text = "Connected";
//gotoAndStop(2);
//Handle init message
//connection.addMessageHandler("init", function(m:Message, myid:int));
//Set my id so we know who we are
//myId = myid
connection.send("Hello World");
connection.addMessageHandler("Hello World", function(m:Message){
trace(m.type);
tf_pressed.text = Message(m).type.toString(); // DISPLAYS "Hello World"
});
connection.addMessageHandler("yesclick", function(m:Message){
//trace(Message(m).getInt(1));
tf_pressed.text = Message(m).type.toString(); // IS NEVER CALLED
});
}
Then I call for the yesclick function when clicking on a button, but the handler never recieves it. ie. the text is never updated