Groups | Blog | Home
all groups > macromedia flash flashcom > january 2006 >

macromedia flash flashcom : onSync Handler


d00mc0ck
1/24/2006 11:58:58 PM
Hi all,

I've got a problem with an onSync handler, hopefully someone can help.

In my client when a button is presseda function is called on the server>>>>

////////////////////////////////////////////////////////////////////////////////
/
newClient.msgFromClient = function() {
var x = newClient.id;
//trace("newClient.id :"+x);
//trace("in function");

application.tanks_so.send("msgFromSrvr", x);
};

////////////////////////////////////////////////////////////////////////////////
//////////////////
The above code sends the client id to a function on the client >>>>


////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
_root.tanks_so.msgFromSrvr = function(x) {
var num = x;
var user = _root.users_so.data.user;
_root.client_nc.call("sendNameToServer", null, user);
}
////////////////////////////////////////////////////////////////////////////
The above function gets the users name & sends it back to a function on the
server.
This is where the problem is. >>>

////////////////////////////////////////////////////////////////////////////////
/////////////////
newClient.sendNameToServer = function(user) {
var uName = user;
var thisTankName = (p+"_"+"tank"+"_"+newClient.tankId);

application.tanksToBeBuilt_so.setProperty(newClient.tankId,{ownedBy:uName,name
:thisTankName});
newClient.tankId++;
};
///////////////////////////////////////////////
The above function is supposed to make a new entry in the "tanksToBeBuilt_so"
RSO with the user who called it and the tank name as parameters.

I've tested the function with a trace statement and the function is
deffinately being entered.

It seems however that the RSO is not being updated and I cant figure out why?

My onSync handler is written as follows >>>>>>


////////////////////////////////////////////////////////////////////////////////
/////////
tanksToBeBuilt_so.onSync = function(tankList) {
trace("tank onsync");
for (var i in tanksToBeBuilt_so.data) {
if (tanksToBeBuilt_so.data != null) {
trace("trace test :"+"owner:"+tanksToBeBuilt_so.data.ownedBy+",
"+"TankName:"+tanksToBeBuilt_so.data.name);
}
}
};
////////////////////////////////////////////////
On the 2nd line of the above onSync I have a trace which is "trace("tank
onsync");".

When the app starts the trace works so the RSO IS being initialized.

Can anybody spot whats up with my code?

Thanks,
Barry.
d00mc0ck
1/25/2006 12:21:54 AM
Sorry,
AddThis Social Bookmark Button