I know this question was probably already asked, however I cant seem to find it.
I have an multi-dimensional array var values=[["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"],["Jan", "Feb","Mar"]]
I then have a text fields labeled textField0
and textField1
and so on.
I would like to create a loop that assigns the array values to the text boxes. Somthing like this (I know this wont work)
//x is the current array
var x=0;
var i=0;
while(i<values[x].length){
textField[i].text=values[x][i];
}
The user can now change the value of x
to choose to display the second sub-array of the months, and the text fields will be populated.
Any help would be appreciated.
Put the TextField
s in an array as well:
var textFields:Array = [textField0, textField1];
Then use a loop to iterate over both arrays:
for (var i:uint = 0; i< textFields.length; ++i)
{
textFields[i].text = values[0][i];
}