5 Replies Latest reply on Sep 29, 2006 12:57 AM by Ed_Syrett

    purging the .sol file

    boybles
      I asked the following question in Flex2 General Discussion, but after several days of nobody touching it, I decided it was better suited for Actionscript3. My question is how do I clear/delete the .sol file (created via SharedObject) when the client closes their browser/ends ther session ?
      Boybles
        • 1. Re: purging the .sol file
          Ed_Syrett
          This works for me....

          // Find out whether we came here from the Portal. If so, there will be
          // a shared object on disk with the User's data in it.
          var so:SharedObject = SharedObject.getLocal("kn.applications.portal.user","/");
          if (so.size == 0)
          {
          // No shared object.
          // Go through standard login.
          }
          else
          {
          // Got a shared object.
          // ...etc...

          // Now blat the shared object so that the user
          // can't login again after closing this app.
          so.clear() ;
          }

          • 2. Re: purging the .sol file
            Ed_Syrett Level 1
            Sorry, I just realised I haven't completely answered your question....

            so.clear() will wipe the shared object file, but at the moment I have no idea as to how you would detect the browser closing....

            ..which begs the question - why do you want to do that? The whole point of a local shared object is to persist after the browser has closed...????
            • 3. purging the .sol file
              boybles Level 1
              Ed,
              Thanks for the suggestion. The reason I'm hoping using the sol file is to set user session info that can be shared with other Flex apps on the client (in other words to function as a client side session cookie), at least while the session is legit, but then "expire" when the session is over. Would this kind of behavior be possible?
              Boybles
              • 4. purging the .sol file
                boybles Level 1
                I found this link which describes sessions in Flex applications. But it doesn't go into .sol files. Anybody have any insight into using .sol files with sessions?
                Boybles
                • 5. purging the .sol file
                  Ed_Syrett Level 1
                  You mention having many flex apps running on the browser in a single session - does that mean you have a single flex app which loads other child apps? Or do you navigate between several apps?

                  If you have a parent app and you're loading child apps into it (using SWFLoader) then you don't need shared objects to communicate between the apps - there's a proper way of doing it documented here


                  However, if you navigate between different flex apps, then shared objects seems to be the only way of doing it. However it seems that you won't get a notification when the browser closes, so you won't know that you have to clear the sol file. Does that matter? The file might hang around on your disk but when you log in to the same app again on the same machine I would expect your first app to overwrite the sol file with new data anyway???