1 Reply Latest reply on Oct 19, 2006 7:10 AM by SmackHack

    SharedObjects

    SmackHack
      Hi All

      Need help to access data from a remote shared object.

      will use this data to populate a dg. but I do not understand how to get hold of the data. I get connected to the FMS fine and get the ref. [object object] from the sharedobject.data however when i try to pase this info something ex an array i get an error saying

      "1118: Implicit coercion of a value with static type Object to a possibly unrelated type Array."

      my code:

      public var Broadcaster_so:SharedObject;

      public var soData:Array = new Array();

      public function doInitSO():void{
      Broadcaster_so = SharedObject.getRemote("broadcaster",nc.uri,false);
      Broadcaster_so.connect(nc)
      soData = Broadcaster_so.data; // "1118: Implicit coercion of a value with static type Object to a possibly unrelated type Array."

      trace(Broadcaster_so.data);
      }

      All help will be appiciated

      thnx
      SH
        • 1. Re: SharedObjects
          SmackHack Level 1
          Dho !!!

          I figured it out.

          if anyone is intrested or want to show me another/berrer way pls submitt.

          Here is my code:

          [Bindable]
          public var currentPublishers:ArrayCollection = new ArrayCollection() ;

          private function syncBroadcaster(event:SyncEvent):void {
          var i:*;
          var Num:Number = 0;

          for (i in Broadcaster_so.data ){
          var gridObj:Object = new Object();
          gridObj.userID = Broadcaster_so.data .userID;
          gridObj.streamName = Broadcaster_so.data
          .streamName;
          gridObj.broadcasterName = Broadcaster_so.data .broadcasterName;
          currentPublishers.addItemAt(gridObj,Num);
          Num++;
          }
          }

          public var Broadcaster_so:SharedObject;

          public function doInitSO():void{
          Broadcaster_so = SharedObject.getRemote("broadcaster",nc.uri,false);
          Broadcaster_so.connect(nc)
          Broadcaster_so.addEventListener(SyncEvent.SYNC, syncBroadcaster);
          }