3 Replies Latest reply on Jul 13, 2010 8:42 AM by james.lyon

    Sharing information Instantly between multiple Local SWFs without a server

    boneitis

      Hey there everyone, so here is my problem:

      I would like to Have a string (JSON object)  that is shared across X number of SWFs that are running locally on the users machine. In addition to that, I would like to 'instantly' (with in a few MS) know when said JSON object has been updated. This needs to be done _without_ a remote server, and in AS3 (duh )

       

      What I've tried:

      Shared Object - Great for storing information across multiple SWFs and have had no problems reading / writing however since it is not remote there is no event (that i know of) to listen to on SWF_A to tell me when SWF_B has changed the SO

       

      Local Connection - this would work with the Shared Object, in place of event listeners to tell everyone else when to update.  However, you cannot 'connect' to the same name more than once.  Becase of this, each application would need to know the name of every other SWF that the user is currently running, and notify individually

       

      And yes, I thought of Timers, and no, they are not the ideal /acceptable solution.

       

      Looked for 3rd party libraries, haven't found any.

       

      Any insight would be super useful.  Thank you.

      -Andrew

        • 1. Re: Sharing information Instantly between multiple Local SWFs without a server
          james.lyon

          You could build your own listener/dispatcher system in a single control swf and give all the other swfs a common localConnection name to register their own individual localConnection names with.

           

          After one of the child swfs updates, it notifies the control swf which notifies all other child swfs. 

           

          I realize this is simply stream-lining your local connection idea, but this would be flexible and scalable.

           

           

          My only other thought would be to use a non-swf native app.

          1 person found this helpful
          • 2. Re: Sharing information Instantly between multiple Local SWFs without a server
            boneitis Level 1

            Yea, I thought about that also, kind of creating a stack, however there are 2 main issues with that.  A timer is still implemented for the 'controlling SO' swf to check for updates, and when / where does the main SWF get created.  Let's say the user has a SWF off my home page www.myexampleurl.com, one a subsequent page: www.myexampleurl.com/checkScores.php, and one in a MySpace widget (LOL myspace) www.myspace.com/myspaceIsLame then the main homepage would create this SWF, however if the user doesn't have the homepage open, where would the SWF go?  This would require working out each application to determine if it  has premissions to open up it's own instance of this swf to handle things.

             

            To do it right, seems like it would take a long time, and to do it fast, seems like it would get super sloppy super fast.  I do appreciate your help though!

            Any other thoughts?

            -Andrew

            • 3. Re: Sharing information Instantly between multiple Local SWFs without a server
              james.lyon Level 1

              I'm not sure you would need a timer if you relied on each individual child swf to actively communicate changes with the controller.

               

              It does complicate things not knowing which page is pulled up first or if that page is closed.  Is opening the control swf in a new window an option?

               

              If so, you could have each child check for the control swf and open a new window if it can't be found.  This would be a fragile solution though.