此方法记住用户名和密码是跨浏览器的,因为保存用户名和密码的的文件保存在本地flash文件中
第一步,存放用户名和密码在flash本地文件中
var userInfoCookie:SharedObject = SharedObject.getLocal("userInfoCookie");
if(rememberUsernameAndPassword.selected) {
userInfoCookie.data.userName = login.username.text;
userInfoCookie.data.password = login.password.text;
userInfoCookie.data.isRememberUsernameAndPassword = true;
} else {
userInfoCookie.data.userName = "";
userInfoCookie.data.password = "";
userInfoCookie.data.isRememberUsernameAndPassword = false;
}
userInfoCookie.flush();
第二步
var userInfoCookie:SharedObject = SharedObject.getLocal("userInfoCookie");
if(userInfoCookie.data.hasOwnProperty("userName") && userInfoCookie.data.isRememberUsernameAndPassword
&& userInfoCookie.data.userName != "") {
this.username.text = userInfoCookie.data.userName;
this.password.text = userInfoCookie.data.password;
this.rememberUsernameAndPassword.selected = true;
}
第一步,存放用户名和密码在flash本地文件中
var userInfoCookie:SharedObject = SharedObject.getLocal("userInfoCookie");
if(rememberUsernameAndPassword.selected) {
userInfoCookie.data.userName = login.username.text;
userInfoCookie.data.password = login.password.text;
userInfoCookie.data.isRememberUsernameAndPassword = true;
} else {
userInfoCookie.data.userName = "";
userInfoCookie.data.password = "";
userInfoCookie.data.isRememberUsernameAndPassword = false;
}
userInfoCookie.flush();
第二步
var userInfoCookie:SharedObject = SharedObject.getLocal("userInfoCookie");
if(userInfoCookie.data.hasOwnProperty("userName") && userInfoCookie.data.isRememberUsernameAndPassword
&& userInfoCookie.data.userName != "") {
this.username.text = userInfoCookie.data.userName;
this.password.text = userInfoCookie.data.password;
this.rememberUsernameAndPassword.selected = true;
}