I am trying to have my program able to read in data from a .csv and display the contents in a specific fashion. I am trying to use the URLLoader class to do so. The following is the code my function for reading in the file
//Instantiate the URLLoader and set up the exception handling associated with it
var loader:URLLoader = new URLLoader();
loader.addEventListener( IOErrorEvent.IO_ERROR, handleIOError );
loader.addEventListener( HTTPStatusEvent.HTTP_STATUS, handleHttpStatus );
loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, handleSecurityError );
loader.addEventListener( Event.COMPLETE, handleComplete );
//Next load the options file that will have location of .csv file
loader.dataFormat = URLLoaderDataFormat.TEXT
loader.load(new URLRequest("testData.csv"));
trace("data: " + loader.data);
Running this code results in the trace printing “data: undefined”, upon debugging I saw that the URLLoader.load wasn’t actually changing any of the fields in loader. My understanding was that this method was supposed to put the loaded data into the data property. If anyone has any ideas as to what could be causing the error I would be extremely grateful.
This is how you should do it programmatically, it’s basically the code format of Torious’s words mentioned above. Good luck!