2 Replies Latest reply on Aug 2, 2011 6:05 AM by Rangora

    Can AIR create a file in localsystem ?

    Benoitcn Level 1

      I want to store some data in a file in the local system specified path or application path.

      What class should I use ?

        • 1. Re: Can AIR create a file in localsystem ?
          flexillu10 Level 1

          Yes, use a sharedObject, or you can use var file:File = File.applicationStorageDirectory.resolvePath("/path/to/file.ext")

          • 2. Re: Can AIR create a file in localsystem ?
            Rangora Level 3

            Somethign like this

             

                var file:File = File.applicationStorageDirectory.resolvePath("image/" + name);
                var fs:FileStream = new FileStream();
                try
                {


                            //open file in write mode
                            fs.open(file,FileMode.WRITE);
                            trace("File is opened to write the contents");

             

                           //write bytes from the byte array
                            fs.writeBytes(image);
                            trace("File write is Completed");


                            //close the file
                            fs.close();
                            trace("File is closed after writing the contents");


                 }catch(e:Error){
                            trace("File write error: " + e.message);
                 }