Anonymous1
Anonymous1

Reputation: 3907

Set SharedObject maximum size

Is there a way to set a (large) maximum size for SharedObject on my domain so that I can ask the user to allocate a size greater than 100k one time and not need to ask again, even if data is added?

Upvotes: 1

Views: 2651

Answers (1)

mems
mems

Reputation: 1264

If you call SharedObject.flush(minDiskSpace:int = 0):String without any amount value, each time you call it for append data, and if the limit is reach, a box will be opened to request the user for change the limit to match to the exact size of data (previous + appended).

So if you always add data (need more space), each time the box will be opened because the data (and the limit) always be greater than the previous one.

So set minDiskSpace to the value of 500k (for example) if you append 49k each time, the user will be ask for the 3th and 11th of times data is appended (only if user allow it, an error is throw for permanent disallowed storage)

See flash.net.SharedObject.flush() documentation:

For example, if you expect a shared object to grow to a maximum size of 500 bytes, even though it might start out much smaller, pass 500 for minDiskSpace. If Flash asks the user to allot disk space for the shared object, it asks for 500 bytes. After the user allots the requested amount of space, Flash won't have to ask for more space on future attempts to flush the object (as long as its size doesn't exceed 500 bytes).

After the user responds to the dialog box, this method is called again. A netStatus event is dispatched with a code property of SharedObject.Flush.Success or SharedObject.Flush.Failed.

Upvotes: 3

Related Questions