Flash AS3 - 我可以阻止我的共享对象保存.swf关闭吗?

时间:2022-06-01 19:00:13

I have a program with a save feature - the user clicks a button, and everything is saved to a local Shared Object with the flush(); command.

我有一个带有保存功能的程序 - 用户单击一个按钮,所有内容都保存到本地共享对象中,并带有flush();命令。

My problem is that Flash .swf files automatically save to the local Shared Object when the movie is closed, overwriting their previous, manual save.

我的问题是,当电影关闭时,Flash .swf文件会自动保存到本地共享对象,覆盖以前的手动保存。

Is there anyway to prevent flash from saving to the shared object as the movie closes?

无论如何都要防止闪存在电影关闭时保存到共享对象?

2 个解决方案

#1


Here's something that could solve your problem but not answer your question. Take the properties of your shared object and duplicate them. If you have "foo", "bar" and "baz" then create "saveFoo", "saveBar" and "saveBaz".

这可以解决您的问题,但不能回答您的问题。获取共享对象的属性并复制它们。如果您有“foo”,“bar”和“baz”,则创建“saveFoo”,“saveBar”和“saveBaz”。

When the movie starts, copy the "save" versions into the run-time variants. "foo = saveFoo; bar = saveBar;" and so on.

电影启动时,将“保存”版本复制到运行时变体中。 “foo = saveFoo; bar = saveBar;”等等。

To save, copy the run-time versions into the "save" variants and flush.

要保存,请将运行时版本复制到“保存”变体并刷新。

Now the auto-save at the end won't change anything as the "save" variants are the only ones that really matter.

现在最后的自动保存不会改变任何东西,因为“保存”变体是唯一真正重要的变体。

Season to taste.

品尝季节。

#2


no, you cannot prevent flash from saving shared objects ...

不,你不能阻止flash保存共享对象...

also, i think, you should not use shared objects to maintain your applications state, unless you want to use that exact effect ...

另外,我认为,你不应该使用共享对象来维护你的应用程序状态,除非你想要使用那个确切的效果......

when you read that object, copy it, and on save, write the copy into the original ...

当你阅读那个对象,复制它,并在保存时,将副本写入原始...

greetz

back2dos

#1


Here's something that could solve your problem but not answer your question. Take the properties of your shared object and duplicate them. If you have "foo", "bar" and "baz" then create "saveFoo", "saveBar" and "saveBaz".

这可以解决您的问题,但不能回答您的问题。获取共享对象的属性并复制它们。如果您有“foo”,“bar”和“baz”,则创建“saveFoo”,“saveBar”和“saveBaz”。

When the movie starts, copy the "save" versions into the run-time variants. "foo = saveFoo; bar = saveBar;" and so on.

电影启动时,将“保存”版本复制到运行时变体中。 “foo = saveFoo; bar = saveBar;”等等。

To save, copy the run-time versions into the "save" variants and flush.

要保存,请将运行时版本复制到“保存”变体并刷新。

Now the auto-save at the end won't change anything as the "save" variants are the only ones that really matter.

现在最后的自动保存不会改变任何东西,因为“保存”变体是唯一真正重要的变体。

Season to taste.

品尝季节。

#2


no, you cannot prevent flash from saving shared objects ...

不,你不能阻止flash保存共享对象...

also, i think, you should not use shared objects to maintain your applications state, unless you want to use that exact effect ...

另外,我认为,你不应该使用共享对象来维护你的应用程序状态,除非你想要使用那个确切的效果......

when you read that object, copy it, and on save, write the copy into the original ...

当你阅读那个对象,复制它,并在保存时,将副本写入原始...

greetz

back2dos