创建对象并写入信息:
import flash.net.SharedObject;
var items_array:Array = new Array(101, 346, 483);
var currentUserIsAdmin:Boolean = true;
var currentUserName:String = "Ramona";
var my_so:SharedObject = SharedObject.getLocal("superfoo","/",false);
my_so.data.itemNumbers = items_array;
my_so.data.adminPrivileges = currentUserIsAdmin;
my_so.data.userName = currentUserName;
my_so.flush(1000);
for (var prop in my_so.data) {
trace(prop+": "+my_so.data[prop]);
}
写在另外一个FLA文件中,读取信息:
import flash.net.SharedObject;
var my_so:SharedObject = SharedObject.getLocal("superfoo","/",false);
for (var prop in my_so.data) {
trace(prop+": "+my_so.data[prop]);
}
文件保存到:
C:\Documents and Settings\jianglang317\Application Data\Macromedia\Flash Player\#SharedObjects\FXHMK25Q\localhost