# Loading data from text file to multidimensional array

**URL:** <https://forum.kirupa.com/t/loading-data-from-text-file-to-multidimensional-array/167914>\
**Category:** flash\
**Created:** [November 2, 2005, 12:10pm UTC](https://forum.kirupa.com/t/loading-data-from-text-file-to-multidimensional-array/167914 "2005-11-02T12:10:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjablonski](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@pjablonski](https://forum.kirupa.com/u/pjablonski)\
**Post date:** [November 2, 2005, 12:10pm UTC](https://forum.kirupa.com/t/loading-data-from-text-file-to-multidimensional-array/167914/1 "2005-11-02T12:10:41Z")

</div>

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&lt;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&lt;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 = "";
}

```

}
