Ok, I’ve got the following code, and I think I’m nearly there, except for the last bit. What I’m trying to do is to import a csv file into a flash array, but for some reason, my final trace statement gives me undefined. What am I missing here? Here’s the code.
var reply_lv:LoadVars = new LoadVars();
var send_lv:LoadVars = new LoadVars();
var rawData:String;
var path:String = "[[U][COLOR=#0000ff]http://localhost/flash/importcombodata/[/COLOR][/U]](http://localhost/flash/importcombodata/)";
var data_arr:Array;
reply_lv.onLoad = function (success){
if (success == true)
{
rawData = this.php_var; //php_var sent by [PHP](http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_22030019.html#)
//trace(rawData);
parseDataIntoArray(rawData);
}
else {
trace("loading error");
}
}
function parseDataIntoArray(rawData) {
data_arr = rawData.split("
");
for (var n:Number=0; n<=data_arr.length-1; n++) {
cols = data_arr[n]
cols_arr = cols.split(",");
for (var i:Number=0; i<=cols_arr.length-1; i++) {
trace(n+":"+i+":"+cols_arr*); //looks ok here
data_arr[n]* = cols_arr*;
}
}
trace (data_arr[1][1]); //outputs undefined!!!
}
send_lv.txtFile = "[data](http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_22030019.html#).csv";
send_lv.sendAndLoad(path+"flashReadTxtFileLV.php",reply_lv,"POST");