flash没有像html的cookies,但是通过SharedObjects可以实现类似的功能。
创建SharedObjects并保存用户名称
//create a shared object to store the user name this line actually //specifies the file name (userFile), it will have an extension of .sol ... var so:SharedObject = SharedObject.getLocal("userFile"); //create and populate a userLoginName property for the shared object... so.data.userLoginName = txtUserLoginName.text; //write the file to the users disk... so.flush();
从SharedObjects中读取数据
var so:SharedObject = SharedObject.getLocal("userFile"); if(so.data.userLoginName != undefined){ this.txtUserLoginName.text = so.data.userLoginName; this.txtPassword.setFocus(); }
删除SharedObjects中的信息
so.clear(); so.flush();