Forum ActionScript 3.0 player.Send values received in disorder O_O

Problems and discussions relating to ActionScript 3.0 here.

player.Send values received in disorder O_O

Postby phuein » December 24th, 2012, 4:10 pm

Hello,

I am glad to be a new developer on the forums. I enjoy and appreciate your hard work with PlayerIO :-)

Code: Select all
// Send Player's starting position.
         Message sPos = Message.Create("startingPosition");
         sPos.Add(player.x);
         sPos.Add(player.y);
         sPos.Add(player.z);
         player.Send(sPos);


^ I send the default values from Server to Client.

Code: Select all
// Add message listener for player starting position data
         connection.addMessageHandler("startingPosition", function(x:int, y:int, z:int) {
             character.x = x;
             character.y = y;
             character.z = z;
             trace(x);
             trace(y);
             trace(z);
         })


^ I receive those values in the Client from the Message handler.

The strange bug I'm encountering is that the values x,y,z are retrieved so: z,x,y. In the development server the values of the variables are displayed correctly (when run, it views the values under them accordingly). Also, the code seems very straightforward. My object character is displayed wrongly, z,x,y. The trace shows the wrong values as well.

What could this be?
phuein
 
Posts: 5
Joined: December 18th, 2012, 4:31 pm

Re: player.Send values received in disorder O_O

Postby phuein » December 26th, 2012, 4:27 pm

Found it!

I forgot that the first data I send is the m:Message itself, and so now I added it to the handling function, and it's working :)

Please close topic. Cheers.
phuein
 
Posts: 5
Joined: December 18th, 2012, 4:31 pm


Return to ActionScript 3.0



cron