I used a database and RemoteObject/Web Services to check a CFC with the query 
to see if the username and password matches and returns any info I need then I 
have something like this:

public function loginHandler(e:ResultEvent):void {
                userData = e.result as ArrayCollection;
                if (userData.length == 1){
                 //Whatever you want to do.
                }else{
                    username_txt.text = "";
                    password_txt.text = "";
                    Alert.show("Incorrect username and/or password. Please try 
again.","Login Error");
                }

            }

I hide the login box and show the rest of the app which I have wrapped in a 
canvas which visible is set to false.

If you dont want to have a database you could use an Array or Object to store 
username and passwords hardcoded and check against them. Or if you have just 
one username/password you could just use something like:

public function login(username:String, password:String):void {

                if (username == "someusername" || password = "somepassword"){

                  //Your code to do whatever you want.

                }else{

                    username_txt.text = "";

                    password_txt.text = "";

                    Alert.show("Incorrect username and/or password. Please try 
again.","Login Error");

                }

            }

----------------------------------------
From: "valdhor" <[email protected]>
Sent: Thursday, February 05, 2009 6:42 AM
To: [email protected]
Subject: [flexcoders] Re: Login / Password Form 

These threads should get you started:

http://www.nabble.com/Login-Registration-Page---tp21747714p21748295.html
http://www.nabble.com/flex-login-popup-help-needed-pleaseeeeeeeee-tp20772482p20833766.html

HTH

Steve

--- In [email protected], "christophe_jacquelin"

<christophe_jacque...@...> wrote:

>

> Hello, 

> 

> I am searching a code source exemple for a classical login / password 

> form in a flex application.

> 

> Did I need absolutely a database to store Passwords ? 

> 

> Thank you, 

> Christophe,

>



Reply via email to