I have an array of items which I would like to be displayed within a dynamic textfield to form a high score list. The amount of items within the arraylist with vary depending on how many high scores are added to it. It is created as standard like this:
var lvl1ScoreArray:Array = new Array();
And items are added to it within the following code:
if (currentLevel == 1)
{
lvl1highScores.push({score:int(vinylCollected) , player:String(highScoreInput.text)});
lvl1highScores.sortOn("score", Array.DESCENDING | Array.NUMERIC);
}
I can obviously trace all the items in the array as follows:
for (var i:int = 0; i < lvl1highScores.length; i++)
{
trace(lvl1highScores[i].score, lvl1highScores[i].player);
}
But I would like to do this within a dynamic textfield called highScoreTxt.. Any suggestions?