在 AS3 中保存/加载文件有哪些好方法?
我正在使用 Flixel 作为基础,在 ActionScript3 中编写一个游戏。我一直无法找到从播放器本地硬盘保存和加载文件的好方法。我知道 Flixel 有一种方法可以将游戏数据保存到……我认为……玩家实际上无法访问的 cookie,我想避免这种情况。
我第一次学习 Java 编程,我经常看到的一件事是从文本文件扫描(Scanner)和打印(PrintWriter)字符串行。对于 AS3 来说,类似的方法是我的理想选择,但如果有其他方法,我也持开放态度。
AS3 的基本库中有什么可以很好地完成这项任务吗?是否有我可以下载并包含的库可以做得更好/更好?
I am writing a game in ActionScript3 using Flixel as a base. I have been unable to find a good method for saving and loading files from the player's local hard drive. I know Flixel has a way to save game data to...I think...cookies that the player doesn't really have access to, and I want to avoid this.
I first learned programming in Java, and one thing I've seen a lot of is scanning (Scanner) and printing (PrintWriter) lines of strings to/from text files. Something like this for AS3 would be my ideal, but if there are other methods I'm open.
Does AS3 have anything in its basic library that can do this task well? Are there libraries I can download and include that do this well/better?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的游戏要在网页上运行,您的选择就很有限。出于安全考虑,Flash 仅限于 读取和写入用户专门选择的文件。
如果您使用 Air 制作独立游戏,您将可以定期访问文件系统,并且可以像 Java 一样写入文件。
如果没有,您将几乎无法使用 Flash cookie 等效项,共享对象。
If your game is going to run on a webpage your options are limited. Due to security concerns Flash is limited to reading and writing files specifically selected by the user.
Should you be using Air to make a standalone game, you will have regular access to the filesystem and can write files much like with Java.
If not, you will be pretty much stuck with Flash cookie equivalent, SharedObject.