         if (!_socket.connected) {
             return;
         }
-        var x :int = (event.stageX - _x) / _charWidth;
-        var y :int = (event.stageY - _y) / _charHeight;
+        var x :int = (event.stageX - _bitmap.x) / _charWidth;
+        var y :int = (event.stageY - _bitmap.y) / _charHeight;
         if (x < 0 || y < 0 || x >= _width || y >= _height) {
             return;
         }

        var mousePad :Sprite = new Sprite();
        addChild(mousePad);
        mousePad.graphics.beginFill(0x0, 0.0);
        mousePad.graphics.drawRect(_x, _y, _width*_charWidth, _height*_charHeight);
        mousePad.graphics.endFill();
        mousePad.addEventListener(MouseEvent.MOUSE_DOWN, sendMouseMessage);
        mousePad.addEventListener(MouseEvent.MOUSE_UP, sendMouseMessage);
        addEventListener(KeyboardEvent.KEY_DOWN, sendKeyMessage);

            }
        }

        // now update the bitmap with the new contents
        _bitmap.bitmapData.lock();
        var srect :Rectangle = new Rectangle(0, 0, _charWidth, _charHeight);
        var dpoint :Point = new Point();
        var drect :Rectangle = new Rectangle(0, 0, _charWidth, _charHeight);
        for (yy = bounds.top; yy < bounds.bottom; yy++) {
            for (xx = bounds.left; xx < bounds.right; xx++) {
                var obj :Object = combined[(yy - bounds.y) * bounds.width + (xx - bounds.x)];
