问题描述
有没有办法来保存应用程序状态保存在AIR文件在桌面上(的Flex / AS3)?
Is there a way to save an application state for save files in AIR for the desktop (Flex /AS3)?
感谢
推荐答案
您需要确保所有的类都的,然后序列化并将其退出应用程序时,保存到一个文件中。
You need to make sure all your classes are serializable, then serialize them and save them to a file when exiting the application.
在重新启动应用程序,你反序列化对象 - 实际上实例化的所有对象,然后重新分配他们所有的previous性质
On starting the application again, you deserialize the objects - in effect instantiating all objects and assigning all their previous properties again.
这可以是相当难复古适合现有的应用程序,因为您的code必须遵守一些规则。例如,你的类的构造函数不能接受任何参数和你的对象必须具有公共属性,否则将不被序列化。
This can be rather hard to retro-fit to an existing application since your code must adhere to a few rules. For instance, your class constructors cannot accept any arguments and your objects must have public properties or they will not be serialized.
这篇文章应该让你加快速度在AS3对象serializaion: http://jacksondunstan.com/articles/ 1642
This article should get you up to speed on object serializaion in as3: http://jacksondunstan.com/articles/1642
这篇关于保存应用程序状态AIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!