Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving application state AIR

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

Thanks

like image 337
ThinkNewDev Avatar asked May 26 '26 12:05

ThinkNewDev


1 Answers

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

like image 71
david.emilsson Avatar answered May 30 '26 03:05

david.emilsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!