ForumsProgramming ForumCreating save files using AS2

4 3507
nosajimiki
offline
nosajimiki
12 posts
30

So, I recently started working again on a game I began a few years back. I noticed that savable flash games became popular about the time AS3 came out; but, I was wondering if there is a way to create a saveable game-state using AS2. If so, how do I create and access them?

  • 4 Replies
Salvidian
offline
Salvidian
4,229 posts
2,255

I'm not entirely sure because I don't use AS2, but I did find several different search results that might help you.



Hope that helps!

nosajimiki
offline
nosajimiki
12 posts
30

Since most tutorials on this are confusing, I created this template for others to use. Just copy it into your _root header, and call the functions from your main menu buttons.

var saveData:SharedObject = SharedObject.getLocal("XXsaveFileNameXX"); // use a unique file name like "starDustV1B12" so that other games will not overwrite it.

function restart(){
_root.saveData.clear();
//

nosajimiki
offline
nosajimiki
12 posts
30

*didn't post right* Since most tutorials on this are confusing, I created this template for others to use. Just copy it into your _root header, and call the functions from your main menu buttons.

[quote]
var saveData:SharedObject = SharedObject.getLocal("XXsaveFileNameXX"); // use a unique file name like "starDustV1B12" so that other games will not overwrite it.

function restart(){
_root.saveData.clear();
//

arobegamr
offline
arobegamr
130 posts
495

Other games can't overwrite your save file. Flash separates shared objects by URL, so only an swf file with the same name and location can save to that shared object. The name is only used to distinguish between different save files for that specific swf.

Showing 1-4 of 4