使用data 的属性来存储它们
注意:切勿将值直接赋给共享对象的 data 属性, 将忽略这些赋值
若要为共享对象创建私有 值(该对象正在使用时只有客户端实例才可以使用该值,并且该值在对象关闭时不与该对象存储在一起),请创建名称不是 data
的属性来存储它们
var bo:Boolean;
var my:SharedObject = SharedObject.getLocal("my");
if (my.data["point"]) {
mc.x = my.data["point"].x;
mc.y = my.data["point"].y;
for (var prop in my.data) {
trace(prop+": "+my.data[prop]);
}
}
stage.addEventListener("mouseDown",Down);
stage.addEventListener("mouseUp",Up);
function Down(e) {
bo = true;
mc.x = mouseX;
mc.y = mouseY;
}
function Up(e) {
trace(mc.x,mc.y,bo);
if (bo) {
my.data.point = new Point(mc.x,mc.y);
my.data.tip = "tip" + mc.x;
var my:SharedObject = SharedObject.getLocal("my");
if (my.data["point"]) {
mc.x = my.data["point"].x;
mc.y = my.data["point"].y;
for (var prop in my.data) {
trace(prop+": "+my.data[prop]);
}
}
stage.addEventListener("mouseDown",Down);
stage.addEventListener("mouseUp",Up);
function Down(e) {
bo = true;
mc.x = mouseX;
mc.y = mouseY;
}
function Up(e) {
trace(mc.x,mc.y,bo);
if (bo) {
my.data.point = new Point(mc.x,mc.y);
my.data.tip = "tip" + mc.x;
my.color = "123" //为共享对象创建私有 值
my.flush();
}
bo = false;
}
my.flush();
}
bo = false;
}