简体   繁体   English

将AS3从时间线保存到sharedObject(可以放置在数组中)

[英]AS3 saving from a timeline to a sharedObject (possible to place in an array)

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. 我试图通过将其存储为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 in a movieClip. 用户可以通过单击按钮在舞台上的各种不同背景之间切换-按钮一个对应于背景一个,背景2对应于btn两个,依此类推...等等,供您参考,这些背景存储在movieClip的子时间轴中。 Any tips on how to get this to store..? 关于如何将其存储的任何提示..? I'm open to new theories as I'm not having a lot of success saving from the movieClip on the time line. 我对新理论持开放态度,因为在时间轴上无法从movieClip节省很多成功。

I have already posted a question similar to this but I was wandering if it was possible to store these frames in an array? 我已经发布了与此类似的问题,但是我在徘徊是否可以将这些帧存储在数组中? Array1 = image1 Array2 = image2 and so making it easier to store. Array1 = image1 Array2 = image2,因此更易于存储。 I'm guessing I would need to make a loadermodule to store these images on the stage as well. 我猜我将需要制作一个loadermodule来将这些图像也存储在舞台上。

Thanks 谢谢

// 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;

CODE ADDED TO MAKE THE TIMELINE SAVE - - - - - - - - - - 添加代码以节省时间----------

// applied to the clickersave function 
mySO.data.myBgFrame = 2;
mySO.flush ();

}

if (mySO.data.myBgFrame){
    caseSwapper.gotoAndStop(mySO.data.myBgFrame);
}

Not sure I understood exactly what you mean, but if you use click on button1 for BG1, in the click function you could write: 不确定我是否完全理解您的意思,但是如果您对BG1使用click1,则可以在click函数中编写:

mySO.myBgFrame = 1;
mySO.flush ();

and than, when you need to set the saved BG: 并且,当您需要设置保存的BG时:

if (mySO.myBgFrame){
    bgMovieClip.gotoAndStop(mySO.myBgFrame);
}

Is this what you need? 这是您需要的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM