1 Reply Latest reply on Aug 15, 2010 10:51 AM by sphinks1

    Login as a component?

    RealBillyBlue

      Hello,

      I've done a login in my main-app and I want to outsource it as a component

       

      If I done this, I could implement my login-component like this

       

              <mx:ViewStack id="Views" width="100%" height="550">
                  <LoginView id="loginView"/>
                  <ReadyView id="readyView"/>
              </mx:ViewStack>
      
      

       

      My problem ist noch, that this login-component ask the user for email and password and check this after the user hit a button. If this entered data is correct, the login-component should tell the parents-app that all things are fine and the main-app should switch to the viewstackchild 'readyView'.

       

      Is this possible?

       

      - bb

        • 1. Re: Login as a component?
          sphinks1 Level 1

          Ou, as I see such question is a common problem, I just start another topic with the same problem. I`ve tried to resolve problem by creating my own event that dispatch to listeners, and I`ve tried to add Listener to main app. Just in case it will such:

          1. You create event: LoginCorrectEvent.

          2. dispacth it.

          3. main app listen to LoginCorrectEvent and make something.

           

          You can check code in this topic http://forums.adobe.com/thread/700947?tstart=0

          But I have problem that I haven`t instance to listen to, but you will have I suppose, so you can make event driven communication. Something like this:

           

          var loginComp:LoginComponent = new LoginComponent();

          loginComp.addEventListener(LoginCorrectEvent.LOGIN_CORRECT_EVENT, loginCorrectHandler);

           

          it will be in you main app, and there you should define loginCorrectHandler - it will handle event.