1

I have game server, FMS 4.5 on Windows, already working prefect, and client apps were created in old CS4, and all is perfect.

Now I want to create a mobile app in AS3, and have a problem with remote shared object, which is working perfect in old flash program.

When users are logged into app, I'm receiving an update with onSync method. But whenever remote shared object is updated, I'm not receiving updates.

for example, on client, where I have main_nc as netConnection object:

var ncu_so:SharedObject = SharedObject.getRemote("Zusers", main_nc.uri, false);
ncu_so.addEventListener(SyncEvent.SYNC, syncNCU);
ncu_so.client=this;
ncu_so.connect(main_nc);

private function syncNCU(e:SyncEvent):void {
    ........
    //here I receive new info....
}

and sample on server...

application.onAppStart = function(){
    this.Zusers_so = SharedObject.get( "Zusers", false );
    ...........
}
function sampleUserEnter(client) {
    var t=new Object();
    t.username=client.username;
    application.Zusers_so.setProperty(client.id,t);
    //this one call is synced with app
}
function sampleChangeName(client,newName) {
    var t=application.Zusers_so.getProperty(client.id);
    t.username=newName;
    application.Zusers_so.setProperty(client.id,t);
    //this IS NOT syncing with app
}

As I said, this code is working with old flash software, but wont update when using AS3. Any idea?

  • "*this code is working with old flash software, but wont update when using AS3*" it you were not using AS3 in CS4 then how is this the same code? What code were you using previously? You are mixing up the IDE name with the language name which doesn't make much sense. Please clarify. – null Oct 02 '16 at 10:32
  • I wrote code for web long time ago in flash CS4 with old as2 which is working. Now I'm doing app for mobile device in as3, and will not change anything on the web server because it is actually working, but in AS3 i have some troubles with refreshing remote shared object, as described. – Војин Петровић Oct 02 '16 at 12:39

1 Answers1

1

I found an easy solution. Not sure why it works but it works....

var ncu_so:SharedObject = SharedObject.getRemote("Zusers", main_nc.uri, false);
ncu_so.addEventListener(SyncEvent.SYNC, syncNCU);
//I add the listener for checking status
ncu_so.addEventListener(NetStatusEvent.NET_STATUS, statusNCU);
ncu_so.client=this;
ncu_so.connect(main_nc);

private function syncNCU(e:SyncEvent):void {
    ........
    //here I receive new info....
}
//In function for NetStatus event, I just set a simple property
//which I do not use in the app..
//and sunchronization start working as usual after initial sync
private function statusNCU(ev:NetStatusEvent):void {
    if (ev.info.code == "NetConnection.Connect.Success") {
        ncu_so.setProperty("anyPropertyName",new Date());
    }
}