Skip to main content
Participating Frequently
August 7, 2009
Question

OnSync for SharedObject isn't working.

  • August 7, 2009
  • 1 reply
  • 1007 views

Hey there,

I am searching for the syntax to call an OnSync event on the server-side. I tried this one but there is neither a compiling error nor anything that is traced.

application.onAppStart = function(){

     trace("onAppstart");

     userList_so = SharedObject.get("userList", false);

     userList_so.onSync=SyncUserList;

}

function SyncUserList(info){

     trace("sync User List");

}

application.onConnect=function(client,userID,username){

     trace("on Connect");

    userList_so.setProperty(userID, {name:username, score:0, priority:-1});

    application.acceptConnection(client);

}

Log:

2009-08-07    09:54:46    960    (s)2641173    onAppstart    -

2009-08-07    09:54:46    960    (s)2641173    on Connect    -

This is just the main stuff of the code. I don't want to spam you

Thanks in advance for your help!

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    August 10, 2009

    Ok, I found the problem:

    Note:  Changing or deleting a property on the server side by using the SharedObject.setProperty() method always succeeds, so there is no notification of these changes.

    Well, how can i make a change otherwise on the server-side, so it will call the onSync Function?

    August 11, 2009

    I'd just handle whatever needs to be done in the server method that changes the SO property. The onSync handler accepts a change list as the single parameter, but if you don't have a change list, the onSync handler really isn't of much use (if you change a property on the server side, you already know about it, so why bother executing the sync handler as well?).