Except that may not be enough. When the application closes, what gets flushed is whatever happens to be in mysharedobject.data. If the program did not update the contents of mysharedobject recently, then anything that changed since the last manual save will be lost.
For instance, let’s say you keep a high score variable in your shared object. Whenever the game ends, you need to manually check if the score reached was better than the high score and if so do something like
mysharedobject.data.highscore = currentscore;
If the player happens to close the game after they beat their previous high score but before this check occured, closing the application will simply cause the old high score to be flushed and the new one to be lost.
And if you don’t save raw data but serialize it before saving it should be obvious that simply closing the application will do nothing to save the most current information.
|