concept login in category flex

This is an excerpt from Manning's book Flex on Java.
There are many ways to implement the login functionality. You can create a separate login screen, a pop up, or implement it inline. Because you’re not going to attempt to prevent users from accessing and browsing the application unless they’re logged in, having a separate login screen that takes users away from the application doesn’t make sense. Neither does blocking the application with a modal dialog forcing them to login, so you’re going with the simplest possible solution, which is to present the user with a couple of fields in the upper-right side of the application for entering the username and password.
Inside the login handler, you create an AsyncResponder to pass into the model, pointing it to the loginResult handler method
and the error handler
. Then you call the login method on your model passing in the username, password, and the responder. Inside the logout handler, you similarly create a responder pointing to the logoutResult
and error handler methods, then call the logout method on your model passing in the responder.
When the login method from the model responds, your login result handler is invoked, and switches the current view state of the login panel, blanks out the password box contents so that the user will be forced to type in a password the next time she tries to login, and displays an Alert stating that she has logged in successfully. On the other side of the equation, when the logout method from the model responds, the logout result handler is called, which switches the view stack back to the initial logged out state, and alerts the user that she has logged out.
and the error handler
. Then you call the login method on your model passing in the username, password, and the responder. Inside the logout handler, you similarly create a responder pointing to the logoutResult
and error handler methods, then call the logout method on your model passing in the responder.