Skip to main content
December 5, 2006
Question

Write to text file?

  • December 5, 2006
  • 1 reply
  • 337 views
The age old question has been "how do you use Flash to write to a file", and the answer has and likely will always be "you can't. You have to use a server side script". Well, hello, Server Side ActionScript. Can you use SSAS to write to a text or xml file?
    This topic has been closed for replies.

    1 reply

    December 5, 2006
    var myFile = new File("myTextFile.txt");
    if(file.exists) file.open("text", "append");
    else file.open("text", "create");
    file.writeln("Hello world!");
    file.close();

    myFile = new File("myXmlFile.xml");
    file.open("text", "create");
    var myXml = new XML();
    //build xml document
    file.write(myXml);
    file.close();

    The text can be sent to the server via a NetStream or via a remote method call.

    /Johan
    http://www.man-machine.se
    December 5, 2006
    Beautiful.

    However, I looked into the mentioned File class, and it looks like it was added in FMS, is there any way to do this in FCS?