Reading files
AIR provides a file system API that can be used to read files of any type from the device.
In this recipe, we will see how to load a file previously written to the device.
Getting ready
If you haven't already done so, complete the Writing files recipe before proceeding.
You can continue to work with the code you wrote during that recipe. Alternatively, from the book's accompanying code bundle, open chapter13\recipe5\recipe.fla
into Flash Professional and work from there.
How to do it...
Let us update the FLA's document class to load and display the preferences that were written to the device.
- Open the document class.
- Add a method that will load the preferences data:
private function loadPreferences():void { file = File.documentsDirectory.resolvePath("prefs.txt"); ...
Get Flash iOS Apps 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.