`
yunzhongxia
  • 浏览: 641596 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

利用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();

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics