Actionscript 3 中的持久数据?
当我尝试制作一个将在多个桌面和移动平台上运行的 Flash 程序并且我想要使用持久数据时,我想要研究哪些包和/或类?
编辑:
我正在开发一个程序,允许人们按照日常学习计划学习某些文本。每天的文本都不一样,我希望每个人都在学习同样的东西。我打算将其导出到 Mac/Windows 投影仪,并且我希望人们也可以在移动设备上使用它。优选地,该程序不应需要互联网连接。
What packages and/or classes do I want to look into when I'm trying to make a Flash program that will run on multiple desktop and mobile platforms and I want to use persistent data?
Edit:
I am working on a program that will allow people to study certain texts following a daily study program. The text is different every day, and I want every person to be studying the same thing. I intend to export this to Projectors for Mac/Windows and I would like to allow people to use it on mobile devices as well. Preferably, the program should not require internet connectivity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
几周前我自己也遇到了这个问题。我在网上找到了一个旧的“as3preferenceslib”类,对其进行了清理,修复了一些错误,现在它工作得很好。这是我的主题:AIR 2 - 数据持久性?
我记得有一些问题代码,但我记得的是 Preferences.as 的 setValue() 函数:
i ran into this issue just a few weeks ago myself. i found an old "as3preferenceslib" class online, cleaned it up, fixed a few of the errors, and now it works great. here's my SO thread: AIR 2 - Data Persistence?
i remember there being a few problems with the code, but the one i remember is in the setValue() function of Preferences.as:
如果您想要使用 Flash 的桌面应用程序,则必须使用 AIR,它提供了用于与文件系统交互的 File 和 FileStream 等类,以及用于与操作系统交互的更多类。
If you want desktop applications with Flash than you have to use AIR which provides classes like File and FileStream for interacting with the filesystem as well as a lot more for interacting with the OS.
此外,如果您希望数据在所有各种应用程序实例之间同步(即,桌面客户端上的更改也会显示在您的手机上),那么您将需要设置一个后端,该后端可以写入数据库,并使用 Web 服务更新应用程序中的数据。
一种简单的方法是使用 MySQL/PHP 堆栈,使用 AMFPHP 之类的东西来处理 Flash 和后端之间的通信。每当您在一个客户端中进行更改时,您都会将该更改推送到服务器并保存。然后,您的应用程序可以在每次启动时检查服务器以查看是否有新数据。
这有道理吗?这是一个非常广泛的答案,但也是一个非常广泛的问题。如果您熟悉后端技术并且我误解了您的问题,请对此发表评论,我会看看是否可以帮助您。 :)
Additionally, if you want the data to be synchronized between all of your various application instances (ie, so changes on the desktop client will show up your phone as well) then you're going to need to set up a back-end that can write to a database, and use web services to update the data in your application.
A simple approach would be a MySQL/PHP stack, using something like AMFPHP to handle communications between Flash and the back end. Any time you make a change in one client, then, you push that change up to the server and it gets saved. You app, then, can check with the server every time it starts to see if there is new data.
Does that make sense? It's a pretty broad answer, but it's a pretty broad question. If you're familiar with back-end technology and I'm misunderstanding your question please leave a comment to that effect and I'll see if I can't help you out. :)
好吧,你本质上是在寻求圣杯应用程序开发平台。您需要它能够在没有互联网连接的情况下轻松实现跨平台同步。简短的回答是,您不会在任何可以被描述为“短”甚至“合理”的时间范围内完成这项工作。 iPhone 不支持 Flash。尽管核心代码是可重用的,但无论如何,您都必须为桌面和移动设备设计和实现单独的 UI。为了使该应用程序在没有互联网连接的情况下运行,您需要提前将所有学习指南编入其中,并希望没有人的设备日历设置不正确。
最好的办法是将其设为网页并需要网络连接和浏览器。这样一来,您就可以制作一个后端,如果您没有时间,甚至可以制作一个 UI,并且所有这些都是同步且最新的。您可以修改它并立即将更新推送给用户。
否则,您将不得不缩小范围或雇用一些开发人员/测试人员。
Ok so you're essentially asking for the holy grail app development platform. And you need it to be easy and synchronized across platforms without an internet connection. Short answer, you're not going to get this done within any time frame that can be described as "short" or even "reasonable". Flash isn't supported on Iphone. Despite the core code being reusable you would have to design and implement separate UIs for desktop and mobile anyway. In order for the app to work without an internet connection you're going to need to program all the study guides into it in advance and hope no one has their devices calendar set up incorrectly.
You're best bet is to make it a webpage and to require a web connection and a browser. That way you make one back end, even one UI if you dont have the time, and its all synchronized and up to date. And you can modify it with updates immediately pushed to the user.
Otherwise you're going to have to cut scope or hire some devs/testers.
Adobe AIR 2.5 在桌面、Android 和 iOS(也许还有其他)上受支持。与网页不同,AIR 应用程序是安装后不需要依赖互联网连接的。但有时,当连接可用时,您可以更新文本并将其存储在文件中。您甚至不必被迫使用 Flex 来做所有事情。如果您在 ActionScript 中有基于 Sprite 的内容,则可以将其放入 rawChildren 中,并根据应用程序进行缩放,使其适应 AIR 的 WindowedApplication。
Adobe AIR 2.5 is supported on desktops, Android and iOS (maybe others as well). Unlike web page, AIR applications are installed and need not to rely on internet connection. But sometimes, when connection is available, you can update texts and store them in files. You aren't even forced to use Flex to do everything. If you have Sprite-based content in ActionScript, you can adapt it to AIR's WindowedApplication by putting it into rawChildren and have it scaled with the app.