如何创建一个按钮来将当前时间线保存在Flash中?

发布于 2025-01-06 05:38:20 字数 121 浏览 6 评论 0原文

我有一个用 Flash CS5 ActionScript3 制作的游戏。我想在游戏中创建一个按钮,可以在其中保存游戏的当前时间线。例如,我停在第 5 帧并保存游戏。所以当我加载它时,我应该立即返回到第 5 帧。我该怎么做?谢谢。

I have a game made by Flash CS5 ActionScript3. I want to create a button in the game where I can save the current timeline of the game. For example, I stopped at frame 5 and save the game. So when I load it, I should instantly return to frame 5. How can I do this? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感性不性感 2025-01-13 05:38:20

就像在本地计算机中存储数据的 cookie

var mySharedObject:SharedObject = SharedObject.getLocal("myGameCookie");//creat a sharedobject

function saveCurrentFrame(){
    mySharedObject.data.lastframe= this.currentFrame;//save lastFramePosition
    mySharedObject.flush();
}

function getLastFrame():int{
  if(mySharedObject.data.lastframe){
    return mySharedObject.data.lastframe;
    };
}

function clearLastFrame(){
  mySharedObject.clear();
}

like a cookie that stor data in your local machine

var mySharedObject:SharedObject = SharedObject.getLocal("myGameCookie");//creat a sharedobject

function saveCurrentFrame(){
    mySharedObject.data.lastframe= this.currentFrame;//save lastFramePosition
    mySharedObject.flush();
}

function getLastFrame():int{
  if(mySharedObject.data.lastframe){
    return mySharedObject.data.lastframe;
    };
}

function clearLastFrame(){
  mySharedObject.clear();
}
仄言 2025-01-13 05:38:20

您还可以将帧编号保存在应用程序的设置文件中。随后,当您重新启动应用程序时,您可以在初始化状态下加载该数字,并在初始化完成时从该帧开始进行渲染。

祝你有美好的一天。

You could also save the number of the frame in a settings file, of your application. Subsequently, when you restart the application, you can load that number in the initialization state, and render from that frame onward when the initialization is complete.

Have a great day.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文