3 Replies Latest reply on Nov 4, 2010 6:48 PM by PruBill

    write and read a text file

    kipper_bottle_num Level 1

      Hi I'm using Flash Cs5 exporting to Air 2

       

      I can write a text file, but am struggling to read in back in. Here is my code so far. Any help would be greatly appreciated

       

      import flash.filesystem.File;

      import flash.filesystem.FileMode;

      import flash.filesystem.FileStream;

       

       

      var settingmike="mike57"

      var filef:File = File.documentsDirectory.resolvePath("settings6.txt");

      var streamf:FileStream = new FileStream();

      streamf.open( filef, FileMode.WRITE );

      streamf.writeUTFBytes(settingmike);

      streamf.close();

      filef = null;

      streamf = null;

       

       

      var fileff:File = File.documentsDirectory.resolvePath("settings6.txt");

      var streamff:FileStream = new FileStream();

      streamff.open( fileff, FileMode.READ);

      streamff.readUTFBytes(settingmike);

      //I want to see it in a text field called my_textfield

      //my_textfield.text=streamff

       

      thanks

       

       

      KBN