13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 39: Storing local data<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

You use the SharedObject class to store small amounts of data on the cli<strong>en</strong>t computer. In Adobe AIR, you can also use<br />

the EncryptedLocalStore class to store small amounts of privacy-s<strong>en</strong>sitive user data on the local computer in an AIR<br />

application.<br />

You can also read and write files on the file system and (in Adobe AIR) access local database files. For more<br />

information, see “Working with the file system” on page 652 and “Working with local SQL databases in AIR” on<br />

page 713.<br />

There are a number of security factors that relate to shared objects. For more information, see “Shared objects” on<br />

page 1063 in “Security” on page 1031.<br />

Shared objects<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

A shared object, sometimes referred to as a “Flash cookie,” is a data file that can be created on your computer by the<br />

sites that you visit. Shared objects are most oft<strong>en</strong> used to <strong>en</strong>hance your web-browsing experi<strong>en</strong>ce—for example, by<br />

allowing you to personalize the look and feel of a website that you frequ<strong>en</strong>tly visit.<br />

About shared objects<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Shared objects function like browser cookies. You use the SharedObject class to store data on the user’s local hard disk<br />

and call that data during the same session or in a later session. Applications can access only their own SharedObject<br />

data, and only if they are running on the same domain. The data is not s<strong>en</strong>t to the server and is not accessible by other<br />

applications running on other domains, but can be made accessible by applications from the same domain.<br />

Shared objects compared with cookies<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Cookies and shared objects are very similar. Because most web programmers are familiar with how cookies work, it<br />

might be useful to compare cookies and local SharedObjects.<br />

Cookies that adhere to the RFC 2109 standard g<strong>en</strong>erally have the following properties:<br />

They can expire, and oft<strong>en</strong> do at the <strong>en</strong>d of a session by default.<br />

They can be disabled by the cli<strong>en</strong>t on a site-specific basis.<br />

There is a limit of 300 cookies total, and 20 cookies maximum per site.<br />

They are usually limited to a size of 4 KB each.<br />

They are sometimes perceived to be a security threat, and as a result, they are sometimes disabled on the cli<strong>en</strong>t.<br />

They are stored in a location specified by the cli<strong>en</strong>t browser.<br />

Last updated 6/6/2012<br />

700

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!