6 Replies Latest reply on Feb 6, 2007 10:18 PM by theLoggerGuy

    to use Shared Object runtime

      I tried to share a string's value between two application, in a way that allow the first one to read a value writed by the second one in runtime. It doesn't work!
      The *.sol file is the same, but maybe each application have a different copy of this file in the own memory
      Infact refreshing the page is possible obtain a correct value.
      This are my SharedObject's instance in the applications:
      var mySO:SharedObject = SharedObject.getLocal("scambio", "/");
      of course in the same domain.

      How can I share data between more application in runtime?
        • 1. Re: to use Shared Object runtime
          This is not a reply I'm afraid, but a variation on the problem. I am also trying to share data between two applications. Both will be on the same PC as a player and editor of multimedia content. The two applications will be distributed as PC projector .exes . I have tested sharing data through Shared Objects with two exactly copied variable declarations:
          public var templatesSO:SharedObject = SharedObject.getLocal("Templates","/")
          but the data is not shared. The first application can seemingly read and write data (I am using arraycollection datatypes) but the second app reads nothing. In the livedocs for exact settings property no mention is made for this type of local content. Please explain what is required to share this locally created shared objects .
          • 2. to use Shared Object runtime
            theLoggerGuy Level 1
            Also not a reply. Same problem. I looked inside my single mysterious SOL file and found that each application was updating the information, but neither of them would read anything, but what they added in. The data from the other application (and for testing purposes I used identical code in different directories) was ignored, despite the fact I could see that the SOL file had been updated.

            Edit: I have noticed that if App1 sets a LSO then App2 can read the common LSO data. If, however, App2 then sets the same data to something else, App1 wont see the changes. Additionally if I go back and repeat App1's setting of the LSO, App2 no longer reads the LSO changes. Any help to get App1 and App2 to consistently talk to each-other via LSOs would be appreciated.
            • 3. Re: to use Shared Object runtime
              Mhmm, it seems to work for me. I have two apps, one writes stuff into a SharedObject, the other reads it.
              Works fine.

              I don't think I do anything special ... I have one actionscript class that does all SO interactions and two mxml application files that both use this class (and a million others ;-). Both compile into different swfs which both get served from the same webserver over the same domain.

              I know this is a one of the "works for me" kinda replies, but at least you know it should work ;-)

              • 4. Re: to use Shared Object runtime

                Did you guys use so.flush(1000) each time immediately after writting? And you may need to wait for "SharedObjectFlushStatus.FLUSHED" and/or "SharedObject.Flush.Success".

                Have fun!

                • 5. Re: to use Shared Object runtime
                  thatadbobestephen Level 1
                  I think I have got to the bottom of the problem and I'm more than a little annoyed that it is not documented and fails without an error message in the most mysterious way. The problem seems to be that the objects included CDATA blocks to encode HTML downloaded via an HTTPservice. Similar objects without the CDATA were fine. What really wasted my time because it was so weird was that data was available from the shared objects after a call to the flush method but before quitting the app, but the data was not really being saved in the SOL files, so disapppeared on quitting the app. I understand the need for care in saving binary data to users hard discs in these virus ridden times but this should be documented and/or should throw a nasty error.
                  • 6. Re: to use Shared Object runtime
                    theLoggerGuy Level 1

                    Originally posted by: rkschulz
                    Mhmm, it seems to work for me. I have two apps, one writes stuff into a SharedObject, the other reads it.
                    Works fine.

                    Thanks for your comments. My app works fine as you described in the above situation, ie. one writes then the other reads. However, when the second app writes to the SharedObject both apps seem to end up with their own copy - neither will read the other's data. To me this seems to miss the point of a "shared" object. I must reload an app to get it to read the data last written to the SharedObject.

                    P.S. Yes I am using so.flush(xxx).