Skip to main content
simplesideias-YmwCeT
Inspiring
October 21, 2012
Question

Remote SharedObject isn't synced/persisted

  • October 21, 2012
  • 1 reply
  • 932 views

I'm using FMS 4.0. I'm trying to use the Remote SharedObject, which I've I used in the past, but nothing seems to work. Even the most simple example doesn't work. No events are triggered on the SO instance (no NetStatusEvent or SyncEvent). No exceptions, no nothing.

import flash.net.NetConnection;
import flash.net.SharedObject;
import flash.events.NetStatusEvent;
import flash.events.AsyncErrorEvent;
import flash.events.SyncEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;

var nc:NetConnection = new NetConnection();
var so:SharedObject;
var url:String = "rtmp://127.0.0.1/live";
var tm:Timer = new Timer(1000);

nc.client = {};

nc.addEventListener(NetStatusEvent.NET_STATUS, function(event:NetStatusEvent):void {
  trace("nc netstatus event", event.info.code);

  if (event.info.code !== "NetConnection.Connect.Success") {
    return;
  }

  so = SharedObject.getRemote("settings", nc.uri, true);
  so.client = {};
  so.addEventListener(AsyncErrorEvent.ASYNC_ERROR, trace);

  so.addEventListener(NetStatusEvent.NET_STATUS, function(event:NetStatusEvent):void {
    trace("so netstatus event", event.info.code);
  });

  so.addEventListener(SyncEvent.SYNC, function(event:SyncEvent):void {
    trace("so synced");
    trace("time", so.data.time);
  });

  so.connect(nc);
  tm.start();
});

tm.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void {
  trace("tick");
  so.setProperty("time", new Date().toString());
});

nc.connect(url);

I'm using the Developer license, so SharedObjects should work.

This topic has been closed for replies.

1 reply

Adobe Employee
October 21, 2012

Use an app other than live and vod. It seems signed apps do not allow shared object creation.

However if you need to use the live service functionality and shared objects together, you can user the main.asc script available in samples instead of the far file.