Flex 3 / Air: Writing blank new lines to files using FileStream

Posted by Edward on Stack Overflow See other posts from Stack Overflow or by Edward
Published on 2010-04-03T08:04:33Z Indexed on 2010/04/03 8:13 UTC
Read the original article Hit count: 342

Filed under:
|
|

I want to write some text directly to a file using Flex 3 / Air. The text on the file (call it "Database.txt") must have the following format:

Line1

Line2

Line3

var FS:FileStream = new FileStream();
var DatabaseFile:File = File.desktopDirectory.resolvePath("Database.txt");
FS.open(DatabaseFile, FileMode.WRITE);
FS.writeUTFBytes("Line1" + "\n" + "Line2" + "\n" + "Line3");
FS.close();

But it writes the following text to the file:

Line1 Line2 Line3.

I'm pretty sure I'm making a very dummy error, but I cannot figure out what it is. Can anyone help me?

Thank you for your time :)

© Stack Overflow or respective owner

Related posts about flex3

Related posts about air