PURPOSE:This Array prototype is used to import vector or array data into a movie parsed into a one or two dimensional array. An optional "isLoaded" method can be defined and executed upon completion.
PROTOTYPE:Array.prototype.getData = function(url, fieldSeperator) {
this.loader=new LoadVars();
this.loader.data=this;
this.loader.onData=function(s){
var p=s.split('\n'), q;
for(var i=0,k=-1;i
if((q=p[i].trim())!="") {
if(typeOf(fieldSeperator)!="string") this.data[++k]=q;
else {
s=q.split(fieldSeperator.charAt(0));
this.data[++k]=new Array();
for(var j=0;j
}
}
}
if(typeOf(this.data.isLoaded)=="function")
this.data.isLoaded();
else this.data.isLoaded=true;
};
this.loader.load(url);
};
USAGE: array.getData( URL, fieldSeperator );
EXAMPLE:myArray = new Array();
myArray.getData( URL, ",");
// OPTIONAL: isLoaded function
myArray.isLoaded=function() {
for(str="",i=0;i
for(j=0;j
str += "myArray["+i+","+j+"] = "+myArray[i][j]+"\n";
str += "\n";
}
gsbTrace( str );
};