Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Im developing a flash game and I'd like to know how much info can I store in a browser cookie.

The game is simple, but it needs to store several variables in order to save all the details of your current progress.

The game is only one swf file, no server, no nothing.

I need to know how should I use the cookies to achieve this, and if they have the posibility of doing it, of course.

(several = 200 variables i.e)

share|improve this question

3 Answers 3

up vote 9 down vote accepted

It is important to note that Flash cookies (or Local Shared Objects, as they are called) are different from browser cookies stored by webpages and JavaScript.

From the Wikipedia article on Local Shared Objects:

By default, a Flash application may store up to 100kb of data to user's hard drive (browser cookies have a limit of just 4kb). The defined storage sizes are 0kb, 10kb, 100kb, 1Mb, 10Mb, and Unlimited. If the current limit is exceeded, the user is shown a dialog requesting storage space of the next size. The user may override the amount manually by clicking the Flash application with right mouse button and selecting Settings; however, this applies only to the domain of the Flash movie. If the selected setting is smaller than the current data size, the data is deleted.

share|improve this answer
    
Didnt know that, thx. –  Artemix Feb 17 '11 at 20:24
    
Users can also disable Local Shared Objects by setting the storage limit to 0kb. Make sure to check that and don't let you application crash because of it. –  bummzack Feb 17 '11 at 21:26
    
@Artemix, you can interact with JavaScript from flash using ExternalInterface and set normal cookies as well. Additionally, you can have flash send XHRs (AJAX) to a server and store data in a database, or session. –  zzzzBov Feb 23 '11 at 16:33
    
Maybe Im wrong, but I think I cant call any JS function when I have only a swf file to work with, most sites (game portals mostly) work with one swf file only, and thats all. –  Artemix Feb 23 '11 at 20:51

Browser cookies are generally limited to 4k, Flash LSOs default to 100k but the user and raise or lower this I think: http://en.wikipedia.org/wiki/Local_Shared_Object

share|improve this answer

Two things to note:

  • Browser cookies need to be transferred back and forth between the client and the server when each page is loaded, which can slow down a site's loading speed.
  • The new HTML 5 client storage APIs can provide a much better solution to storing data on the client side. This can, of course, be transferred back and forth between the client and the server when necessary. Check this article for more info.
share|improve this answer
    
Im making a Flash game, but thx anw. –  Artemix Feb 23 '11 at 20:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.