# Dynamic Multi-Dimensional Arrays

**URL:** <https://forum.kirupa.com/t/dynamic-multi-dimensional-arrays/171377>\
**Category:** flash\
**Created:** [December 4, 2005, 11:51pm UTC](https://forum.kirupa.com/t/dynamic-multi-dimensional-arrays/171377 "2005-12-04T23:51:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hybred](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@hybred](https://forum.kirupa.com/u/hybred)\
**Post date:** [December 4, 2005, 11:51pm UTC](https://forum.kirupa.com/t/dynamic-multi-dimensional-arrays/171377/1 "2005-12-04T23:51:01Z")

</div>

hello all - again i must ask the superbrain of kirupa for help

following on from \*\*B.Rich’\*\*s great [color=#003366] **Multi-Dimensional** Arrays and attachMovie [/color][color=black]tutorial, i’m trying to load the array from an external source.[/color]  
i’ve got a text file that outputs:

myArray=samuel price,28,[http://www.hybred.co.uk|becky](http://www.hybred.co.uk%7Cbecky)  
holland,28,[http://www.hybredproductions.co.uk|mark](http://www.hybredproductions.co.uk%7Cmark)  
ovenden,31,[http://www.hybred.co.uk/mark](http://www.hybred.co.uk/mark)

i then try to break this down in flash into a multi-dimensional array that provides info for dynamic buttons:

var myVars:LoadVars = new LoadVars();  
var newArray:Array = new Array();

myVars.onLoad = function(success) {  
if (success) {  
newArray = recreateArray(this.myArray);  
trace(newArray);  
//Starting x & y values  
var xPos = 250;  
var yPos = 100;  
for (i=0; i\<newArray.length; i++) {  
attachMovie(“container”, “main”+i, i, {\_x:xPos, \_y:yPos});  
yPos += this[“main”+i].\_height+5;  
this[“main”+i].name.text = newArray\*[0];  
this[“main”+i].interest.text = newArray\*[1];  
this[“main”+i].link = newArray\*[2];  
}

}  
}  
myVars.load(“textfile.txt”);  
function recreateArray( textArray:String ) : Array {  
var multiDimentionArray:Array = new Array();  
var singleDimentionArray:Array = textArray.split("|");  
for (x = 0; x \< singleDimentionArray.length; x++) {  
multiDimentionArray.push(singleDimentionArray[x].split(","));  
}  
return multiDimentionArray;  
}

however its not working at all. i’m not sure if its because the attachMovie loop is not getting initiated or what…

if anyone could spare a few minutes to help there would be serious apriciation :beam:

pre emptive thanks!!
