O'Reilly logo

Flash Development for Android Cookbook by Joseph Labrecque

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving data across sessions through local shared object

Shared objects have been used for years in browser-based Flash applications. They are sometimes referred to as "Flash Cookies" or "Super Cookies" and do provide much of the same functionality as normal browser-based cookies, but are tailored more to the Flash environment. Normally explicit permissions are needed to save such data using a Flash application on the web; however, using AIR frees us of many of these restrictions.

How to do it...

Create a local SharedObject to preserve specific application data across sessions. We will use an interactive Sprite to illustrate this visually:

  1. First, we will need to import the following classes:
    import flash.display.Sprite; import flash.display.StageAlign; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required