5 Replies Latest reply on Aug 22, 2006 5:57 PM by ntsiii

    Need to refresh application

    targetplanet Level 1
      Is there a way to refresh an application?
      I need to have a logout function in my app, and erase all of the set vars and states, etc, basically starting the app over.
      Does anyone have an affective logout script?
        • 1. Re: Need to refresh application
          upshotvideo Level 1
          you could reload the html page, but there is prob. a better way to do, i'm still looking myself.
          • 2. Re: Need to refresh application
            ntsiii Level 3
            Flex is designed to KEEP state. I don't know of any built in way to re-initialize the app. I would just identify the objects that need initializing and do it manually.

            Reloading the html wrapper is an absolute sure thing though, and would take very little code.

            On the other hand, there might well be data that you do not need to refresh.

            It should partly depend on the workflow, taking into account the users experience. You are just going to have to decide, and make it so.

            • 3. Re: Need to refresh application
              upshotvideo Level 1
              I also have a similar situation, and it would be easy to just write a function to reset those variables, but im in the middle of a large project that consists of a viewstack that contains custom components. Im finding it very difficult to reach other canvas' and their scripts/variables from outside the scope of any given script in the viewstacks children. YOu can always create a class with static props so they can be accessed and changed from any script that imports the class, but how do you "refresh" a canvas or
              change or execute methods that reside in other scripts in other components. I've used Application.application..... and it gets me to where i can trace the numChildren of the viewstack in the main application. And I can get to this from anywhere, but when trying to go as far as reaching a httpservice or textfield in any of those viewstacks...no dice.
              SO, indeed, a "refresh" would be nice if it were an option. Then it could just start everything over(send services/change text fields) all based on the NEW values, whereever you may be storing them.
              • 4. Need to refresh application
                targetplanet Level 1
                Yea you would think that would be a feature they would have included, with the focus being on applications and all.
                I just decided to reload the html page on log out. It seems messy, but it works for now.
                • 5. Re: Need to refresh application
                  ntsiii Level 3
                  Ya, this is one of those things that would be reasonable if you planned for it from the start and structured you data to support it, but would be a miserable task if you had to add it later.

                  If you bind component's data to a central data structure, then this would be easy.