Skip to main content
Participant
March 15, 2007
Question

how to share a ShareObject in client and server ?

  • March 15, 2007
  • 2 replies
  • 293 views
hi,all

I have a question. It is too hard. Who can help me,? Your advise is really helpful.

My question is .. I create a video chat application and main.asc file in FMS2

It will be catched in (application.onDisconnect = function (clientObj) ) function when a client disconnect server , Send a message via shareobject in onDisconnect .
Other clients will update user list after other clients get the message.
But I find the ShareObject can not share in server and client.

Codes in FMS main.asc
application.onAppStart = function () {
. ....
sharedlist[0] = SharedObject.get("A_shared",true);
....
}

application.onDisconnect = function (clientObj){
sharedlist[0].data.textValue = "userlist";//
sharedlist[0].setDirty("textValue");
}

Codes in client :

text_so = SharedObject.getRemote("A_shared", client_nc.uri, true);

But I find shared object list in FMS_console. below

Name type connections
---------------------------------------
A_shared Stored 1
A_shared Temp 1

Server send message via shareobject, But client can not receive message , client can receiver message for other client send message .

how to share a ShareObject in client and server ??
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    he4330937Author
    Participant
    March 21, 2007
    your means is :
    I write below codes in main.asc file.

    application.onDisconnect = function (clientObj){
    my_so.setProperty("textValue", "hhh");
    }

    "hhh" will retrieve in client .
    var txt:String = text_so.data.textValue;
    txt value is "hhh" ???


    March 15, 2007
    I think I see where you're going wrong.

    The syntax for writing properties to an SO on the server side is different than it is on the client side.

    On the client side, we set properties like this:

    my_so.data.property = value;

    on the server side, it looks like this:

    my_so.setProperty(propertyName, value);