2 Replies Latest reply on May 17, 2007 9:14 AM by James Bower

    Clearing the data on logout

    Vyshak
      Hi all,

      Flex newbie here.. I just want to know how to clear the data that i fetched from server on logout. My application have multiple components and each component have different states. Once i logout and login, am getting the previous state before i logout. How to solve this problem? please help me out.
        • 1. Re: Clearing the data on logout
          Vyshak Level 1
          Anybody ter to help me out?
          • 2. Re: Clearing the data on logout
            James Bower Level 1
            I'd start with the "loginResultHandler" function and use it to direct the user to a specific component within a ViewStack whenever they login or log back in.

            For example:

            [Bindable]
            private var currentUser:User = new User();

            private var currentFunction:Function;

            private function loginResultHandler(event:ResultEvent):void {
            currentUser = event.result as User;
            if (currentUser.loggedIn)
            {
            if (currentUser.roles == "admin")
            {
            Application.application.myViewStack.selectedIndex=0;
            }
            else
            {
            Application.application.myViewStack.selectedIndex=1;
            }
            loginForm.visible=false;
            currentFunction.call();
            }
            else
            {
            Alert.show("Login unsuccessful", "Server Authentication");
            }
            }

            This may or may not be the answer you are looking for but it should get you going in the right direction. Check out some of the great Flex tutorials at Lynda.com ( http://movielibrary.lynda.com/html/modListing.asp?pid=205)

            Good luck!