New to Actionscript here so please bear with me, I’m trying to learn. I’m developing a simple application which loads specific information based on user input. The code below works fine and does exactly what I want, however, I want to be able to load the raceInfo multidimensional array information from an external text file. I’ve read alot about doing this but have not been successful and am somewhat frustrated. Can someone help me and teach me how to get that information from a text file? Thanks in advance!
//Multidimensional Array
raceInfo=[[“1”,“Bob Smith”,“Fast”,“Slow as Lightening”],[“2”,“John Doe”,“Speedy Car”,“Running Fast”]];
var testText1 = testText1_txt.text;
var testText2 = testText2_txt.text;
//trace(testText1);
//trace(testText2);
loadBtn.onRelease = function () {
for(i=0;i<raceInfo.length;i++) {
if(testText1 == raceInfo*[0]) {
_root.createEmptyMovieClip("container1",1);
container1.loadMovie("/scoutpics/" + testText1 + ".jpg");
container1._x = 150;
container1._y = 150;
scoutName1_txt.text = raceInfo*[1];
carNumber1_txt.text = raceInfo*[0];
carName1_txt.text = raceInfo*[2];
slogan1_txt.text = raceInfo*[3];
}
}
for(i=0;i<raceInfo.length;i++) {
if(testText2 == raceInfo*[0]) {
_root.createEmptyMovieClip("container2",2);
container2.loadMovie("/scoutpics/" + testText2 + ".jpg");
container2._x = 650;
container2._y = 150;
scoutName2_txt.text = raceInfo*[1];
carNumber2_txt.text = raceInfo*[0];
carName2_txt.text = raceInfo*[2];
slogan2_txt.text = raceInfo*[3];
}
}
resetBtn.onRelease = function () {
testText1_txt.text = "";
testText2_txt.text = "";
container1._visible = false;
container2._visible = false;
scoutName1_txt.text = "";
scoutName2_txt.text = "";
carNumber1_txt.text = "";
carNumber2_txt.text = "";
carName1_txt.text = "";
carName2_txt.text = "";
slogan1_txt.text = "";
slogan2_txt.text = "";
}
}