A class to help automate and simplify save game functionality. Basically a wrapper for the Flash SharedObject thing, but handles some annoying storage request stuff too.
Constructor
Variables
Methods
bind(Name:String, ?Path:String):Bool
Automatically creates or reconnects to locally saved data.
Parameters:
Name | The name of the object (should be the same each time to access old data).
May not contain spaces or any of the following characters: |
---|---|
Path | The full or partial path to the file that created the shared object, and that determines where the shared object will be stored locally. If you do not specify this parameter, the full path is used. |
Returns:
Whether or not you successfully connected to the save data.
close(MinFileSize:Int = 0, ?OnComplete:Bool ‑> Void):Bool
A way to safely call flush() and destroy() on your save file. Will correctly handle storage size popups and all that good stuff. If you don't want to save your changes first, just call destroy() instead.
Parameters:
MinFileSize | If you need X amount of space for your save, specify it here. |
---|---|
OnComplete | This callback will be triggered when the data is written successfully. |
Returns:
The result of result of the flush() call (see below for more details).
erase():Bool
Erases everything stored in the local shared object. Data is immediately erased and the object is saved that way, so use with caution!
Returns:
Returns false if the save object is not bound yet.
flush(MinFileSize:Int = 0, ?OnComplete:Bool ‑> Void):Bool
Writes the local shared object to disk immediately. Leaves the object open in memory.
Parameters:
MinFileSize | If you need X amount of space for your save, specify it here. |
---|---|
OnComplete | This callback will be triggered when the data is written successfully. |
Returns:
Whether or not the data was written immediately. False could be an error OR a storage request popup.