I have my Flash project properties set for: AIR 3.4 for Desktop and ActionScript 3.0...
I created a button for the user to select a file (csv) from the local drive. I then want to be able to get the string value of the File Object but do not know how...
Here is what I have so far:
BTN_CSV.addEventListener(MouseEvent.CLICK, getCSV);
var myFile:File = new File();
function getCSV(e:MouseEvent):void {
var docFilter:FileFilter = new FileFilter("Documents", "*.csv");
myFile.browse([docFilter]);
myFile.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(event:Event) {
var csvData = myFile.nativePath;
csvData = csvData.data.split("\n");
parseCSV(csvData);
}
I'm getting an error 1061: Call to a possibly undefined method split through a reference with static type flash.utils: ByteArray. I don't know how to get the file path for the file obj...