O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

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

Chapter 30. File Access

FEATURED CLASSES

  • flash.net.FileReference

  • flash.net.FileReferenceList

Flash Player can help your users connect their content with the rest of the world. With a good file API, you empower users to share their video, images, audio, and documents; to generate or receive receipts, maps, and shopping lists; and even to edit, post-process, or mash up songs or videos.

Abilities of the File API

The file management abilities of Flash Player have evolved over time, so different versions of Flash Player support different operations. Uploading files to the web via an HTTP post and saving files to the user's system from an HTTP request are supported in Flash Player 9 and up. Opening local files, accessing their content as a ByteArray, and saving content from Flash Player directly into a file on the user's system are supported in Flash Player 10 and up.

The AIR runtime includes even more detailed control over files, such as a stream interface to files, file-browsing components, and scripted access to files. I won't cover AIR runtime features here.

Any time you deal with files in Flash Player, the user is prompted to select a file or destination with a standard system dialog box. At no time can Flash Player open or save a file on its own accord. Nor can ActionScript code browse through the filesystem at will, even if the user is doing just that. Control is passed entirely away from ActionScript while the user confirms file actions.

Introducing FileReference

All file access in Flash ...

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