2 Replies Latest reply on May 4, 2007 2:37 AM by home_aidan

    checking for a sharedobject

    home_aidan
      hi guys..
      I now have my sharedobject working, but i would now like to check if one exists before mysite goes anywhere.

      basically i want to check for a
      shared object called test.
      if it does exist goto frame2 if it doesnt go to frame1

      can anyone show me how to do that?

      cheers
      Aidan
        • 1. Re: checking for a sharedobject
          Level 7
          Aidan,

          > I now have my sharedobject working, but i would now
          > like to check if one exists before mysite goes anywhere.

          The static SharedObject.getLocal() method returns a reference to the
          specified shared object *if it already exists*. If it doesn't, that method
          creates a new one for you. So either way, you get a shared object -- but
          the newly created one won't (yet) have anything in hits data property.

          var so:SharedObject = SharedObject.getLocal("someSharedObject");
          if (my_so.data.someProperty != undefined) {
          // your someProperty is not undefined, so you know
          // this shared object already exists and contains data
          } else {
          // otherwise ... start populating that custom property :)
          }


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: checking for a sharedobject
            home_aidan Level 1
            Cheers David,
            Will give that a bash.