I found this in the Sample files in the Flash 8 folder...
import mx.controls.*;
var status_lbl:Label;
var username_ti:TextInput;
var password_ti:TextInput;
password_ti.password = true;
submit_btn.clickHandler = function() {
checkForm();
};
var formListener:Object = new Object();
formListener.enter = function(evt) {
checkForm();
};
username_ti.addEventListener("enter", formListener);
password_ti.addEventListener("enter", formListener);
Selection.setFocus(username_ti);
function checkForm() {
if (username_ti.text.length == 0) {
status_lbl.text = "<font color=\"#EFDFDC\">Please enter user name.</font>";
Selection.setFocus(username_ti);
return false;
}
if (password_ti.text.length == 0) {
status_lbl.text = "<font color=\"#EFDFDC\">Please enter password.</font>";
Selection.setFocus(password_ti);
return false;
}
status_lbl.text = "";
var result_lv:LoadVars = new LoadVars();
var login_lv:LoadVars = new LoadVars();
login_lv.username = username_ti.text;
login_lv.password = password_ti.text;
login_lv.sendAndLoad("http://www.flash-mx.com /mm/login.cfm", result_lv, "POST");
result_lv.onLoad = function(success:Boolean) {
if (success) {
if (this.isValidLogin == 1) {
status_lbl.text = "<font color=\"#009900\">login successful.</font>";
} else {
status_lbl.text = "<font color=\"#EFDFDC\">invalid user name / password.</font>";
Selection.setFocus(username_ti);
Selection.setSelection(0, username_ti.text.length);
}
} else {
status_lbl.text = "Unable to connect to login URL";
username_ti.enabled = false;
password_ti.enabled = false;
submit_btn.enabled = false;
}
};
return true;
}
I took out all of the comments.That would be nice if someone could explain this this code,because I'm sure a lot of people would like to use a script like this,but also know how it works and such.
Yes,you'll need a server or something...