flash - Pointing a File object to a directory Actionscript 3.0 -


i want able write file called "records.csv", works if specify exact directory url of "records.csv". program wouldn't work on computer..

so trying find out how point "records.csv", , in same folder .fla

this savefile function:

function savefile():void {     var file:file = file.applicationdirectory;      file = file.resolvepath('records.csv');     // create stream object read/write, , open in append mode     var stream:filestream = new filestream();     stream.open(file, filemode.append);     // add new line text file;     stream.writeutfbytes("\n" + (speedometerbox.text) + ',' + (rpmbox.text) + ',' + (carbonometerbox.text) + "\n" ); } 

i have tried using userdirectory, documentsdirectory, desktopdirectory, applicationstoragedirectory not work.. don't know i'm doing wrong!

simply change to:

var file:file = new file() function selectfolder():void{    file.addeventlistener(event.select, savefile);    file.browsefordirectory(); }  function savefile(e:event):void {     file = file.resolvepath('records.csv');     // create stream object read/write, , open in append mode     var stream:filestream = new filestream();     stream.open(file, filemode.append);     // add new line text file;     stream.writeutfbytes("\n" + (speedometerbox.text) + ',' + (rpmbox.text) + ',' + (carbonometerbox.text) + "\n" ); } 

Comments