获取当前域的所有共享对象
使用 SharedObject.getLocal 我可以通过在方法调用中使用唯一标识符来访问看似无限数量的文件;我想知道的是如何检索为当前域保存的所有活动文件或共享对象的列表。
我正在尝试编写一个保存游戏机制,允许您保存游戏(可能很多兆字节),因此使用单个共享对象似乎可能会导致性能问题,但是如果我使用多个对象,我不确定我会如何找出已保存的内容,而无需使用对象来指定其他保存的 id - 那么我的问题就变成了如果删除或删除此“标头”对象会发生什么 - 玩家如何访问其他文件?
Flash 文档中的一个片段:
本地磁盘空间注意事项。本地共享对象有一些限制,在设计应用程序时必须考虑这些限制。有时,SWF 文件可能不允许写入本地共享对象,有时存储在本地共享对象中的数据可能会在您不知情的情况下被删除。 Flash Player 用户可以管理单个域或所有域可用的磁盘空间。当用户减少可用磁盘空间量时,某些本地共享对象可能会被删除。 Flash Player 用户还具有隐私控制功能,可以防止第三方域(当前浏览器地址栏中的域以外的域)读取或写入本地共享对象。
还有让我担心的一点:
一些本地共享对象可能会被删除
一些?哪些??哈哈。
非常感谢, 克里斯
Using SharedObject.getLocal I can get access to what appears to be an infinite number of files simply by using unique identifiers in the method call; What I want to know is how can I retrieve a list of all active files or shared objects that have been saved for my current domain.
I'm trying to write a save game mechanism that allows you to save your game (potentially many megabytes) so using a single shared object seems like it might cause performance issues however if I use multiple objects I'm not sure how I'd find out what has been saved without using an object just to specify the id's of the other saves - then my question becomes what happens if this "header" object is removed or deleted - how can the player access the other files?
A snippet from the flash docs:
Local disk space considerations. Local shared objects have some limitations that are important to consider as you design your application. Sometimes SWF files may not be allowed to write local shared objects, and sometimes the data stored in local shared objects can be deleted without your knowledge. Flash Player users can manage the disk space that is available to individual domains or to all domains. When users decrease the amount of disk space available, some local shared objects may be deleted. Flash Player users also have privacy controls that can prevent third-party domains (domains other than the domain in the current browser address bar) from reading or writing local shared objects.
And the bit that worries me:
some local shared objects may be deleted
Some? Which ones?? lol.
Many thanks,
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我决定只允许用户保存X数量的游戏;然后我可以给它们所有特定的 ID(即 1-10),然后我所要做的就是尝试使用该 ID 访问每个共享对象并检查它是否是有效文件。甜蜜又简单。
出于某种原因,我的大脑试图将其扩展到数十万个文件,但这并不是真正必要的;没有文件夹管理限制用户是一件好事!
I've decided to only allow the user to save X number of games; then I can give them all specific IDs (i.e. 1-10) then all I have to do is just try to access each shared object with the ID and check if it's a valid file or not. Sweet and simple.
For some reason my brain was trying to scale it out to hundreds of thousands of files but it's not really necessary; with no folder management limiting the user is a good thing!
使用共享对象可能不是存储重要数据的最佳途径。您可以创建任何服务器代码来将您保存的游戏数据存储在数据库中吗?
我很好奇保存游戏数据中可能有兆字节的内容是什么?
Using shared objects might not be the best route to go for storing important data. Can you create any server code to store your saved game data in a database?
I'm curious what's in the save game data that may be megabytes?