AS3保存共享对象时间表(AS3 Saving a sharedObject timeline)

2019-11-03 01:32发布

我希望有人能提供一个简单的解决方案。 我试图把它作为一个共享对象,以节省时间线上的“标记”框架。

用户通过点击一个按钮,在舞台上各种不同背景之间的可翻转 - 一个按钮对应一个背景,背景2对应于BTN两...等供您参考这些背景都存储在一个子时间表。 如何得到它来存储任何提示..?

//// ---------------- WINDOW SWAPPER -------------------

this.but_one.btn_one.addEventListener(MouseEvent.CLICK, swapperslide);

function swapperslide(event:MouseEvent):void
{
     this.caseSwapper.gotoAndStop("frametwo");
}

this.but_one.btn_two.addEventListener(MouseEvent.CLICK, swapperslidetwo);

function swapperslidetwo(event:MouseEvent):void
{
     this.caseSwapper.gotoAndStop("framethree");
}

save_btn.addEventListener (MouseEvent.CLICK, clickersave);


// ---- saves ----------------------- 
function clickersave (e:MouseEvent):void {
mySO.data.myframe = timelineframe;
////mySO.data.my_y = bones_mc.y;
mySO.flush ();
} 

谢谢

PS上的影片剪辑的帧也包含AS3停止();

编辑更新代码-----------------------------

//SAVE FUNCTIONS ---------------------------------------
//---------------------------------------------------
//---------------------------------------------------

var mySO:SharedObject = SharedObject.getLocal("iDesign");

bones_mc.x = mySO.data.my_x;
bones_mc.y = mySO.data.my_y;

if (!mySO.data.my_y) {
bones_mc.x = 424;
bones_mc.y = 119;
}

//----
save_btn.addEventListener (MouseEvent.CLICK, clickersave);

function clickersave (e:MouseEvent):void {
mySO.data.my_x = bones_mc.x;
mySO.data.my_y = bones_mc.y;
mySO.data.mybut_x = btrfly_mc.x;
mySO.data.mybut_y = btrfly_mc.y;
mySO.data.mytig_x = tiger_mc.x;
mySO.data.mytig_y = tiger_mc.y; 
mySO.data.mybow_x = pink_bow_mc.x;
mySO.data.mybow_y = pink_bow_mc.y;
mySO.data.myblkbow_y = pink_bow_mc.y;
mySO.data.myblkbow_x = pink_bow_mc.x;   
 // tears saved - - - - -  - -
mySO.data.mytear_drop_mc_three_x = tear_drop_mc_three.x;
mySO.data.mytear_drop_mc_three_y = tear_drop_mc_three.y;
mySO.data.mytear_drop_mc_one_x = tear_drop_mc_one.x;
mySO.data.mytear_drop_mc_one_y = tear_drop_mc_one.y;
mySO.data.mytear_drop_mc_two_x = tear_drop_mc.x;
mySO.data.mytear_drop_mc_two_y = tear_drop_mc.y;
mySO.data.mytear_drop_mc_four_x = tear_drop_mc_four.x;
mySO.data.mytear_drop_mc_four_y = tear_drop_mc_four.y;
    mySO.data.myframe = caseSwapper.currentFrame;   
    trace(caseSwapper.currentFrame)
mySO.flush ();
}

//caseSwapper.currentFrame = mySO.data.myframe;

tear_drop_mc_three.x = mySO.data.mytear_drop_mc_three_x;
tear_drop_mc_three.y = mySO.data.mytear_drop_mc_three_y;

Answer 1:

为了存储当前帧,你需要使用currentFrame属性。

mySO.data.myframe = caseSwapper.currentFrame;


Answer 2:

要存储在共享对象值,必须先得到参考:

function clickersave (e:MouseEvent):void {
    var mySo:SharedObject = SharedObject.getLocal("SomeName");
    mySo.data["my_y"] = bones_mc.y;
    mySo.flush();
}


文章来源: AS3 Saving a sharedObject timeline