Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flash AS3 AIR : Create Plain Text File
// maybe need some other imports also, add if needed
import flash.filesystem.File;
import flash.filesystem.FileStream;
import flash.filesystem.FileMode;
// saves file to C:\Users\username\AppData\Roaming\APPID\Local Store\
var myfile:File = File.applicationStorageDirectory.resolvePath("hello.txt");
var mystring = "Hello World!";
// create file
fileStream.open(myfile, FileMode.WRITE);
// output to it
fileStream.writeUTFBytes(mystring);
// close
fileStream.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.