I just read The Trick to Using SharedObject, and I have an idea of what could be causing it.
You’ll want to specify a path and a local root when you call SharedObject.localData()
.
If you don’t use a local path or name the save will be stored based on where the game is served from on the server. For example, if you’re uploading to a game site, fakesite.com
, and they store the games at uploads/username/gamename/version
, and your SavedObject
call was
// Create a game save.
var savedGame:SharedObject = SharedObject.getLocal("save");
#SharedObjects/<random code>/fakesite.com/uploads/quasar/game-title/1/#save.sol
If you updated your game, your saved object would be stored at
#SharedObjects/<random code>/fakesite.com/uploads/quasar/game-title/2/#save.sol
Since these are different paths, the .swf will not be able to find it!
Furthermore, if you don’t set a custom name but you do use a local path,
// Create a game save.
var savedGame:SharedObject = SharedObject.getLocal("save", "\");
all of your saved data would be stored at
#SharedObjects/<random code>/fakesite.com/#save.sol
Since save
is such a common name for game saves, there could very likely be multiple games with poorly-written saving that use the same file, causing potential corruption of data.
tl;dr
You’ll want to specify a path and a local root when you call SharedObject.localData()
.
// Create a game save.
var savedGame:SharedObject = SharedObject.getLocal("quasar/game-title/save", "/");
// Create game settings (for muting, input, et cetera).
var savedSettings:SharedObject = SharedObject.getLocal("quasar/game-title/settings", "/");
The first path, quasar/game-title/save
plus the local path, /
, will specify the location the data is stored on your user’s computer. If you uploaded this game, the saved directory would be found at
#SharedObjects/<random code>/fakesite.com/#quasar/game-title/save.sol
This is both unique (to prevent data corruption) and static (to ensure the file is always where you want it).