Sending Array to client... (few more questions)

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

Sending Array to client... (few more questions)

Postby poppop » 21 May 2008, 21:15

Hi again,

Having a problem.

I would like to send an array of user objects to the client:


(server side)

Code: Select all

      var response = {}
      response._cmd = "startup"
      response.values = []
      response.x = uVars.myX
      response.y = uVars.myY
      response.Thezones = allZones[45][0]
      _server.sendResponse(response, -1, null, [user])



But this dosnt work.

The allZones array holds user objects.

What i would then like to do is, on the client side,

Comment out this:

(client side)

Code: Select all

smartfox.onJoinRoom = function(roomObj:Room){

/*
for (var i:String in userList)
   {
      var user:User = userList[i]
      trace("already in room: " + user.getId())
   }
*/
}


And, using my array of user objects, somewhere in here:

Code: Select all

smartfox.onExtensionResponse = function(resObj:Object, type:String)
{

   if (resObj._cmd == "startup")
      {


for (var i:String in resObj.Thezones)
   {
      var user:User = resObj.Thezones[i]
      trace("already in room: " + user.getId())
   }

}

}



Alot of this is a "copy and paste" job -- sorry.

I'm trying to do this, so each client dosnt need to know about every user in the room, only people in a "Zone". So the zone array may hold say, 30 user objects, and the room could actually contain 500 players.

My main problem is:

1. My array will not send from the server to the client.

2. My client isnt picking up an array of user objects as somthing that can use the user class.



Any help would be amazing!

Thanks.
ramindeja
Posts: 74
Joined: 31 Mar 2008, 17:54

Postby ramindeja » 22 May 2008, 19:26


Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 3 guests