Saving application state AIR

爷,独闯天下 提交于 2019-12-10 20:19:34

问题


Is there a way to save an application state for save files in AIR for the desktop (Flex /AS3)?

Thanks


回答1:


You need to make sure all your classes are serializable, then serialize them and save them to a file when exiting the application.

On starting the application again, you deserialize the objects - in effect instantiating all objects and assigning all their previous properties again.

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.

This article should get you up to speed on object serializaion in as3: http://jacksondunstan.com/articles/1642



来源:https://stackoverflow.com/questions/9251926/saving-application-state-air

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!