Copy link to clipboard
Copied
Hi guys,
I'm new to AS3 and dealt with AS2 before (just getting the grasp when the change it).
Is it possible in AS3 to load an excel .csv file into Flash using the URLLoader (or ???) and the data as variables?
I can get the .csv to load and trace the values (cell1,cell2,cell3....) but I'm not sure how to collect the data and place it into variables.
Can I just create an array and access it like so.... myArray[0], myArray[1]? If so, I'm not sure why it's not working.
I must be on the completely wrong path. Here's what I have so far....
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, dataLoaded);
var request:URLRequest = new URLRequest("population.csv");
loader.load(request);
//...
function dataLoaded(evt:Event):void {
var myData:Array = new Array(loader.data);
trace(myData);
}
Thanks for any help,
Sky
just load your csv file and use the flash string methods to allocate those values to an array:
var myDate:Array = loader.data.split(",");
Copy link to clipboard
Copied
just load your csv file and use the flash string methods to allocate those values to an array:
var myDate:Array = loader.data.split(",");
Copy link to clipboard
Copied
Thanks again Kglad, your one of the most helpful and reliable people out there.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more