3 Replies Latest reply on Jan 15, 2011 9:08 AM by 62316e

    Making One Object Move, both players see it fine, but very slow.

    vinceaction Level 1

      Hi there,

       

      I am simply trying to send one object (movieClip) move from the left side of the stage to the right side. I am able to accomplish this by using the following very simple code:

       

      /////////////////////////////CODE///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////

      //PRESSING RIGHT, MAKING BOX MOVE

      public function pressingRightMakingBoxMove(e:KeyboardEvent) {

       

                box.x += 3;

                moveBox.sender = netGroup.convertPeerIDToGroupAddress(netConnection.nearID);

                moveBox.user = "" + netConnection.nearID;

                moveBox.xx = box.x;

           netGroup.post(moveBox);

      }

       

       

       

       

      public function netStatus(event:NetStatusEvent) {

           switch(event.info.code){

                case "NetConnection.Connect.Success":

                     setupGroup();

                break;

                case "NetGroup.Posting.Notify":

                     receiveBoxMovement(event.info.message);

                break;

          }

      }

       

       

      public function receiveBoxMovement(moveBox:Object):void{

            box.x = moveBox.xx;

      }

      ////////////////////////////////////////////////////////////////////////////////////////// ENDCODE//////////////////////////////////////////////////////////////

       

      It works fine, the box moves on both screens, but you can obviously tell there is latency. Should I be sending movements through an Object? Perhaps there is a quicker way, sending it through strings or text? Definitely not acceptable over UDP.

       

      Thank you