ActionScript 3的节能currentframe位置本地硬盘驱动器? [英] Actionscript 3 saving currentframe location to local hard drive?

查看:112
本文介绍了ActionScript 3的节能currentframe位置本地硬盘驱动器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问过类似的问题,前一段时间,但我想提出新的要更具体一些,我的问题的一些示例!

I asked similar question sometime ago, but I am making new one to be much more specific with my question with some example!

从来就发现了这个code段/教程从谷歌上搜索,但我似乎无法弄清楚如何修改我的需要:

I´ve found this code snippet/tutorial from googling, but I cant seem to figure out how to modify it for my needs:

// open a local shared object called "myStuff", if there is no such object - create a new one
var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
// manage buttons
btnSave.addEventListener(MouseEvent.CLICK, SaveData);
btnLoad.addEventListener(MouseEvent.CLICK, LoadData);

function SaveData(MouseEvent){
 savedstuff.data.username = nameField.text // changes var username in sharedobject
 savedstuff.flush(); // saves data on hard drive
 }
function LoadData(MouseEvent){
 if(savedstuff.size>0){ // checks if there is something saved
 nameField.text = savedstuff.data.username} // change field text to username variable
 }

// if something was saved before, show it on start
if(savedstuff.size>0){
nameField.text = savedstuff.data.username}

那么,我想弄清楚如何做的,就是为用户节省当前帧到本地硬盘驱动器,因为我的闪存进步是基于帧的位置。是啊,所以我怎么修改它,以便它存储当前帧的数据?怎么样里面的影片剪辑当前帧,如果是这样做的东西有什么不同?

So what I am trying to figure out how to do, is to save users current frame to local hard drive, as my flash progress is based on frame location. yeah, so how do I modify it so that it stores data of current frame? and how about current frame inside movieclip, if that is makes things different?

帮助MUUUCH AP preciated!谢谢!

help MUUUCH appreciated! thanks!

推荐答案

在你的榜样,它看起来像它已经挽救一些东西到共享对象:

In your example it looks like it is already saving something to the shared object:

savedstuff.data.username = nameField.text;

刚刚与影片剪辑的帧值替换它,而不是(也可能以不同的属性名称等,然后用户名)。

Just replace it with the movie clip frame value instead (and probably under a different property name other then "username").

然后在负荷,还有另一行,其中它加载数据:

Then on load, there is another line where it loads the data:

nameField.text = savedstuff.data.username;

这将是同样的方式,除了将用户名与任何属性的名称,你选择。那么你可能要解析成一个int再次使用它来恢复进度但是方式您有它建立起来。

It would be the same way, except replace "username" with whatever property name you choose. Then you may have to parse into an int again and use it to restore progress however way you have it set up.

这篇关于ActionScript 3的节能currentframe位置本地硬盘驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆