Advertisement
Guest User

Untitled

a guest
Feb 14th, 2011
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import playerio.*
  2. stop()
  3.  
  4. //Connect and join the room
  5. var connection:Connection;
  6.  
  7. var gameID:String = "real-time-interpolated-ibf9makikyjykif7yig"
  8. PlayerIO.connect(stage, gameID, "public", "User" + Math.floor(Math.random()*1000).toString(),   "", handleConnect,  function(){trace("connect error")}  );   //This connects us to our game server
  9.  
  10. function handleConnect(client:Client){ // Called on successful connection
  11.     trace("Connected to server")
  12.     client.multiplayer.createJoinRoom("test", "upper",  false, {},  {}, handleJoin, function(error){trace(error)}   ); //Makes us join or create the room "test"
  13.     nextFrame();
  14. }
  15.  
  16. //called when a user joins the room
  17. function handleJoin(conn:Connection){
  18.     trace("joined")
  19.     connection = conn
  20.     //This will call gotMessage every time we receive any message
  21.     connection.addMessageHandler("*",gotMessage);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement