Source

FlSock / test.html

Full commit
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js"></script>
<style type="text/css" media="all">
  body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
  }
  #container {
    width: 100%;
    height: 100%;
  }
  #container div {
    margin: 3px;
    border: 1px solid #aaa;
    padding: 3px;
    position: absolute;
  }
</style>
<script type="text/javascript">

var fxs = {};

function flsock_handleMessage(message) {
  var c = message.split(':');
  var uid = c[0], name = c[1], x = parseInt(c[2]), y = parseInt(c[3]);
  var el = $(uid) || new Element('div', {id: uid, text: name, styles:{left: -50, top: -50}}).inject('container');
  var fx = fxs[uid] || new Fx.Morph(el, {duration: 1000, wait: false});
  fx.start({left: x - el.getWidth()/2, top: y - el.getWidth()/2});
}

function flsock_connectHandle() {
  $('sock').joinRoom('playground');
}

function flsock_closeHandle() {
  alert('closed');
}

function flsock_ioErrorHandle() {
  alert('ioerror');
}

function flsock_securityHandle() {
  //alert('security');
}

swfobject.embedSWF("FlSock.swf",
	"sock", "50", "50", "9.0.0", "",
	{host: 'flsock.barbuza.info', port: 8881},
	{wmode: "opaque", allowfullscreen: true, allowscriptaccess: "always", bgcolor: "#FFFFFF"},
	{});

window.addEvent('domready', function() {
  
});


function enter() {
  var uid = 'p' + Math.ceil(Math.random() * 100000);
  var name = $('name_input').value;
  
  var me = new Element('div', {id: 'me', text: name}).inject('container');
  
  var myFx = new Fx.Morph(me, {duration: 1000, wait: false});
  $('auth').dispose();
  $('container').addEvent('mousedown', function(e) {
    myFx.start({
      left: e.client.x - me.getWidth() / 2,
      top: e.client.y - me.getHeight() / 2
    });
    $('sock').sendMessage(uid + ':' + name + ':' + e.client.x + ':' +  e.client.y);
  });
}

</script>
</head>
<body>
  <div id="sock"></div>
  <div id="container">
    <div id="auth">
    name: <input type="text" id="name_input" /><input type="button" onclick="enter()" value="enter" />
    </div>
  </div>
</body>
</html>