Chapter 16. Storing Persistent Information
Introduction
You already know how to work with data that is stored in memory as long as a Flash movie is open. In fact, almost all data you work with in ActionScript is of this type. But what if you want to be able to store data between Flash movie sessions? Or what if you want to be able to share data between Flash movies running on the same client, or even on different clients? To accomplish these feats, we’ll need to look at how we can store and transmit data outside of the Flash Player.
This chapter addresses both client-side and server-side data. First,
we’ll examine client-side data. Prior to Flash 6,
the only way to store persistent data on the client was with complex
techniques that invoked external JavaScript functions to read and
write cookies. However, Flash 6
introduced
local
shared objects
to
ActionScript, making it possible to store and retrieve persistent
data on the client without the use of these other, complicated
techniques.
We’ll also take a closer look at server-side data.
Prior to Flash 6, server-side data manipulation was limited to
invoking server-side scripts (using loadVariables(
)
or an XML
object) to read and write
data to text files and/or databases on the server. The problem was,
of course, that this functionality required that you had the
necessary scripts on the server. While this kind of functionality
still has its place (although the LoadVars
class
supercedes the older loadVariables( )
method), this chapter ...
Get Actionscript Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.