Return to Snippet

Revision: 21759
at December 20, 2009 03:05 by allnatural


Initial Code
private var file : File;
      private var fileStream : FileStream;
      private var fileContents : String;
      private const ISO_CS : String = "iso-8859-1";

      private function init() : void
      {
        file = new File();
        file = File.applicationDirectory.resolvePath("file.txt");
        fileStream = new FileStream();
        fileStream.addEventListener( Event.COMPLETE, fileComplete );
        fileStream.openAsync( file, FileMode.READ );
      }
      private function fileComplete( event : Event ):void
      {
        fileContents = fileStream.readMultiByte( fileStream.bytesAvailable, ISO_CS );
        trace( "fileContents="+fileContents );
      }

Initial URL
http://www.destroyyourcomputer.com

Initial Description
Read a file from the FileSystem

Initial Title
Access file on FileSystem

Initial Tags
files

Initial Language
ActionScript 3