AS3保存共享对象时间表 [英] AS3 Saving a sharedObject timeline
问题描述
我希望有人可以提供一个简单的解决方案。 我试图把它作为一个共享对象,以节省时间线上的标记框。
用户可以在各种不同背景的舞台上通过点击按钮翻转 - 按钮一次对应的背景之一,背景2对应于BTN两个等等... 供您参考这些背景都存储在一个子时间表。关于如何得到这个存储任何提示..?
//// ----------------窗口交换技术---------------- ---
this.but_one.btn_one.addEventListener(MouseEvent.CLICK,swapperslide);
功能swapperslide(事件:MouseEvent)方法:无效
{
this.caseSwapper.gotoAndStop(frametwo);
}
this.but_one.btn_two.addEventListener(MouseEvent.CLICK,swapperslidetwo);
功能swapperslidetwo(事件:MouseEvent)方法:无效
{
this.caseSwapper.gotoAndStop(framethree);
}
save_btn.addEventListener(MouseEvent.CLICK,clickersave);
// ----节省-----------------------
功能clickersave(E:的MouseEvent):无效{
mySO.data.myframe = timelineframe;
////mySO.data.my_y = bones_mc.y;
mySO.flush();
}
感谢
诗在影片剪辑中的帧中还含有砷 停止();
编辑更新,code -----------------------------
//保存功能---------------------------------- -----
// ------------------------------------------------ ---
// ------------------------------------------------ ---
VAR mySO:共享对象= SharedObject.getLocal的(■设计);
bones_mc.x = mySO.data.my_x;
bones_mc.y = mySO.data.my_y;
如果(!mySO.data.my_y){
bones_mc.x = 424;
bones_mc.y = 119;
}
// ----
save_btn.addEventListener(MouseEvent.CLICK,clickersave);
功能clickersave(E:的MouseEvent):无效{
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;
//泪保存 - - - - - - -
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;
跟踪(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;
为了保存当前帧,你需要使用 currentFrame
属性。
mySO.data.myframe = caseSwapper.currentFrame;
I was hoping someone could offer a simple solution. I am trying to save a 'labeled' frame on the timeline by storing it as a SharedObject.
The user can flip between various different backgrounds on the stage by clicking a button - button one corresponds to background one, background 2 corresponds to btn two and so on... For your reference these backgrounds are stored in a sub timeline. Any tips on how to get this to store..?
//// ---------------- 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 ();
}
Thanks
P.s the frames on the movie clip are also contain AS3 stop();
Edit updates to code -----------------------------
//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;
In order to store the current frame, you need to use currentFrame
property.
mySO.data.myframe = caseSwapper.currentFrame;
这篇关于AS3保存共享对象时间表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!