当前位置: 代码迷 >> Web前端 >> 利用SharedObjects保留信息
  详细解决方案

利用SharedObjects保留信息

热度:107   发布时间:2012-08-26 16:48:06.0
利用SharedObjects保存信息

??????? 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();

?

?

  相关解决方案