Hi,
How can I create a .txt file using flex 3? And I want to write some datas in to this file...... Is it possible? Any one can help me?
Thanks in advance.. Nimmy
Hi,
How can I create a .txt file using flex 3? And I want to write some datas in to this file...... Is it possible? Any one can help me?
Thanks in advance.. Nimmy
//set File object
var file:File=File.documentsDirectory;
file=file.resolve(“myFile.txt”);
//set Stream object
var stream:FileStream=new FileStream();
//set FileMode
stream.open(file, FileMode.READ);
var data:String= stream.readUTFBytes(Stream.bytesAvailable);
//close file
stream.close();
different FILEMODE:
FileMode.APPEND: write only, append new data to the bottom of the file;
FileMode.READ: read only, file must exist;
FileMode.UPDATE: both read / write the data where positioned where you want;
FileMode.WRITE: write only , if file doesn't not exist, will be created otherwise will be overwritten;