Skip to main content
Participant
June 5, 2013
Question

Understanding remote shared objects

  • June 5, 2013
  • 1 reply
  • 622 views

Hi Fellow users, I am using a remote shared object in my Flash Media Server project for the first time. My purpose of using a rso is to update data in real-time accross multiple clients.

Ok, I like to store a list of users who are connected to my application. And when a client disconnects I want the object updated to all other clients connected and the online status list is revised.

I dont know what the best approach is for this... Is it possible to use the onSync event?  And put the clients in an array and when their properties are changed the server is dispatched and updated. Or, would you recommend other alternatives?

Interested to hear your thoughts and opinions guys.

Thanks

This topic has been closed for replies.

1 reply

Participating Frequently
June 5, 2013

Yes, the onSync event also gives you reasons for each update (add/remove). You may use external array but you are not necessarily required to do so, you may access so.data anytime to get access to all the properties of shared object any time. A good approach would be to store user identifiers as property names and the user info objects as values of those properties.

Participant
June 8, 2013

Thank you Rajesh. Apologies for my late reply. Are you suggesting I do something like this? In the code below I have included a changeList array to describe the change properties of each member in a remote shared object. Furthermore, I have created so.data property to store attributes of the rso when a user changes one of the slots it triggers the syncEvent. Can someone please take a good close look at my code to see if you can identify any errors? thanks in advance.

function syncExample(event:SyncEvent):void{

     my_rso.data.username1;

     my_rso.data.username2;

     my_rso.data.username3;

     my_rso.data.username4;

     my_rso.data.username5;

for (var i = 0; i <changeList.length; i++){

var changeList:Array = event.changeList;

var info:Object;

info = changeList;

switch(info.code){

   case "success"

  lient_info = my_rso.data[info.name];

  

   case "change":

   client_info = my_rso.data[info.name];