Sending Array to client... (few more questions)
Posted: 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)
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)
And, using my array of user objects, somewhere in here:
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.
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())
}
*/
}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.