Skip to main content
Participant
March 12, 2013
Answered

CSV file to Array Problem

  • March 12, 2013
  • 1 reply
  • 645 views

I have been struggling with importing a csv file and creating an array. I am able to have the file display with the commas in a dynamic text box but can't figure out how to use the commas to separate the data into grids.

If anyone can help it wouldbe very much appreciated. I have two weeks to complete this and have spent countless hours researching a solution. Thank you in advance.

My current code is:

var loader: URLLoader = new URLLoader();

loader.load(new URLRequest("external.csv"));

loader.addEventListener(Event.­COMPLETE, onComplete);

function onComplete(event:Event):void

{

external_txt.text = event.target.data;

}

The comma delimited file is "external.csv" and the dynamic text field's name is "external_txt"

Thanks again

This topic has been closed for replies.
Correct answer Ned Murphy

You should only need to use the split() method of the String class to turn the csv text into an array.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
March 12, 2013

You should only need to use the split() method of the String class to turn the csv text into an array.

Participant
May 4, 2013

Thank you Ned. We ended-up doing a database instead but I appreciate your help. I hope you have a great weekend.