Flash CS4/AS3 从本地游戏写入本地文件而没有保存对话框提示?
我正在编写一个在用户计算机上本地运行的游戏。不是通过互联网。
我想要一个保存用户名和头像索引的文件(它们位于一个数组中)。
我想知道是否有一种方法可以使用 AS3 通过 Flash 写入文件。我用的是CS4。
我还想知道您是否可以通过 Flash 删除文件,尽管这只是可选的。
预先感谢您可以提供的任何帮助。
I'm writing a game to be run locally, on the user's computer. NOT over the internet.
I want to have a file that will hold the usernames and avatar indices (they're in an array).
I want to know if there's a way to write to files through Flash with AS3. I'm using CS4.
I'd also like to know if you can delete files through Flash, though that's just optional.
Thanks in advance for any help you can give.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想制作一款在某人的计算机上本地运行的游戏,您应该在 Adobe AIR 中制作。 AIR 应用程序可以读取和写入文件,并执行各种有用的操作,例如在任务栏中显示更新等。而您在本地下载并运行的简单 SWF 无法执行在浏览器中无法执行的任何有用操作- 首先,它无法写入或删除本地文件。 (它可以读取本地文件,但前提是您禁用它访问网络。)此外,独立的 Flash 播放器通常不会传播,因此除非用户是 Flash 开发人员,否则他们只会在浏览器中查看您的 SWF无论如何(除非你打算发布投影仪,我也不推荐)。
尽管如此,即使您将游戏作为本地 Flash 内容进行,您仍然可以使用 SharedObject 来存储信息。它们离线时的工作方式与在线时相同。您无法将数据写出作为单独的文件,但您可以轻松地将其存储在会话之间。
If you want to make a game that runs locally on someone's computer, you should make it in Adobe AIR. AIR apps can read and write files, and do all sorts of useful things like show updates in the taskbar, etc. Whereas a simple SWF that you download and run locally can't do anything useful that it couldn't already do in the browser - it can't write or delete local files, for a start. (It can read local files, but only if you disable it from accessing the network.) Moreover, the standalone Flash player is not generally disseminated, so unless the user is a Flash developer they're just going to view your SWF in a browser anyway (unless you plan to publish projectors, which I also wouldn't recommend).
With all that said, however, even if you do your game as local flash content, you can still store information by using SharedObjects. They work the same way offline as online. You can't write the data out as a separate file, but you can store it between sessions easily enough.
如果我明白你想要做什么那么你为什么不使用 Adobe AIR?这是桌面版的 Flash
if i understand what you are trying to do then why dont you use Adobe AIR? this is flash for the desktop