3 Replies Latest reply on Jun 29, 2007 8:19 PM by jaswcomp

    ViewState Login

    jaswcomp
      I'm using a <mx:ViewState> control to present the user with a login and the switching the view once they have successfully logged in. I have a persistent object to hold the user info, but when I hit the refresh in my Flex app I get sent back to login screen. How can I maintain the users "session" after they hit refresh?
        • 1. Re: ViewState Login
          Sigmar85
          What is yor type of persistent object ?

          When you refresh try to find your persistent object. If your object exist and it is good, set the viewStack to the good view.

          <mx: Application ... creationComplete=hello()>

          private function hello():void
          {
          <-- cookie test or session test-->
          yourViewStack.selectedChid=LogIsAlright;
          }

          with LogIsAlright : Container (Canvas, HBox,...)
          • 2. Re: ViewState Login
            jaswcomp Level 1
            I did try that test, but the object does not exist.

            I just have a user object that exists in the <mx:Application> tag. I thought about using a cookie or a SharedObject to store some user information (no passwords or anything).

            I'm not sure if that is the best way to persist an object.

            I guess I'm asking what is the best practices for persisting a Flex "session" across browser refreshes?

            When the user hits refresh i want to maintain the application state.
            • 3. Re: ViewState Login
              jaswcomp Level 1
              I experimented with a SharedObject and that seems to work quite well. Is there a way to automatically expire a SharedObject?