views:

15

answers:

2

Using SharedObject.getLocal I can get access to what appears to be an infinite number of files simply by using unique identifiers in the method call; What I want to know is how can I retrieve a list of all active files or shared objects that have been saved for my current domain.

I'm trying to write a save game mechanism that allows you to save your game (potentially many megabytes) so using a single shared object seems like it might cause performance issues however if I use multiple objects I'm not sure how I'd find out what has been saved without using an object just to specify the id's of the other saves - then my question becomes what happens if this "header" object is removed or deleted - how can the player access the other files?

A snippet from the flash docs:

Local disk space considerations. Local shared objects have some limitations that are important to consider as you design your application. Sometimes SWF files may not be allowed to write local shared objects, and sometimes the data stored in local shared objects can be deleted without your knowledge. Flash Player users can manage the disk space that is available to individual domains or to all domains. When users decrease the amount of disk space available, some local shared objects may be deleted. Flash Player users also have privacy controls that can prevent third-party domains (domains other than the domain in the current browser address bar) from reading or writing local shared objects.

And the bit that worries me:

some local shared objects may be deleted

Some? Which ones?? lol.

Many thanks, Chris

A: 

I've decided to only allow the user to save X number of games; then I can give them all specific IDs (i.e. 1-10) then all I have to do is just try to access each shared object with the ID and check if it's a valid file or not. Sweet and simple.

For some reason my brain was trying to scale it out to hundreds of thousands of files but it's not really necessary; with no folder management limiting the user is a good thing!

widgisoft
A: 

Using shared objects might not be the best route to go for storing important data. Can you create any server code to store your saved game data in a database?

I'm curious what's in the save game data that may be megabytes?

Henry
It's a tile based game with a fully destructible world; all of the tile data has to be stored so you can return to how you left it; I'll be using compression on the actual tiles and then compressing the byte array but it's still in the region of 4-8MB per save.
widgisoft
I want to have the option to save on the server or locally; the local version is easy to start with as the bandwidth is much better but trying to push all that data up and down to a server will be it's own little challenge :-D.I think it's probably going to be closer to 2.5MB; The map is 80x8192 and I think I can compress it down to 4 bytes per tile; I'm currently contemplating shrinking the map down to half it's height anyway so it might not be so bad for the server version.
widgisoft