4 Replies Latest reply on Apr 18, 2007 1:36 AM by JabbyPandaUA

    Restarting A Flex Application Programmatically

    FlextasmicD
      Howdy folks,

      I have just created a database driven user management system which works wonders, but I'm having a problem with logging out a user. By far the easiest, sure fire way of doing this would be to clear the users login in the database (not really relevant to the problem) then restart the application programmatically (as if the user pressed the refresh button in thier browser) which would bring them back to the login screen at the start of the application. Is re-initialising the application possible to do in actionscript?

      If not it would involve clearing user specific variables, resending http requests which relate to the login, removing permissions based controls and all this over many modules... just a hell of a lot of what may be unesscessary work, especially if all that really needs to happen is the application to re-initialise.

      Any help on this would be amazing!

      Many thanks
        • 1. Re: Restarting A Flex Application Programmatically
          mattyb1515
          My initial suggestion is to wrap your flex application in a PHP web page and let PHP do the authentication/deauthentication. To logout the user you can create a PHP function that destroys the session variable and then refresh/redirect to the login/home page of your application.
          • 2. Re: Restarting A Flex Application Programmatically
            FlextasmicD Level 1
            quote:

            Originally posted by: mattyb1515
            My initial suggestion is to wrap your flex application in a PHP web page and let PHP do the authentication/deauthentication. To logout the user you can create a PHP function that destroys the session variable and then refresh/redirect to the login/home page of your application.

            Thanks for the reply but I'm afraid it isn't as easy as that.

            I'm a php guru and I do use PHP and FlashVars for use with authentication but only to 'remember' user information when the user opens up a different application (basically if they log into one application, theyre logged into the rest). Using 'out of application' authentication is of no use when it comes to a permissions based user system and applying dynamic permissions (such as "this user can see this menu", "this user cant press this button") to a flex application. It's clearing these permission variables I'd prefer not to do if the application can be programmatically re-initialised which would have the same effect.
            • 3. Re: Restarting A Flex Application Programmatically
              babo_ya Level 3
              I ran into the same issue and I tried alot different ways to get this work but,... I ended up resetting all my objects/variables/data objects... and others... Hopfully someone else could help us... :) but i doubt it.
              • 4. Re: Restarting A Flex Application Programmatically
                JabbyPandaUA Level 3
                We reset all input fields and data objects by hand.

                for example, a function "clear' can look like that:

                function clear() {
                txtUserNameInput.text = "";
                txtPasswordInput.text = "";
                userVO = new userVO();

                }