1 Reply Latest reply on Mar 13, 2007 6:03 PM by ntsiii

    Shared Objects

      Got a problem. I have stored IDs in a local shared object, as follows:

      var so:SharedObject = SharedObject.getLocal("ex");
      so.data.userID = 1;
      so.data.userName="Joe Bloggs";

      This all works fine and I can verify this with trace statements.

      However I want to call this shared object with AS3 from another mxml component in a script tag. I tried as follows:

      var mySO:SharedObject = SharedObject.getLocal("ex");
      var userID:int = mySO.data.userID;
      var userName:String=mySO.data.userName;

      Compiler complains that it can't find userID. I have imported flash.net.SharedObject. Puzzled! I seem to have developed a blind spot on this one. Can anyone suggest where I'm going wrong?

        • 1. Re: Shared Objects
          ntsiii Level 3
          Consider this, from the docs: "To avoid inadvertently restricting access to a shared object, use the localpath parameter. The most permissive approach is to set localPath to / (slash), which makes the shared object available to all SWF files in the domain, but increases the likelihood of name conflicts with other shared objects in the domain."

          That parameter defaults to null.