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

Opening a local file from device storage

Oftentimes, we may want to read certain files from the application storage or from some other location on our Android device. In the following example, we will perform this action upon a simple text file, but this can also be used to read in all sorts of files from image data to encoded MP3 audio bytes.

How to do it...

Employ a variety of classes within the flash.filesystem package to open local file data within an application:

  1. First, we will need to import the following classes:
    import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; import ...

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