I have an array which looks like this:
public var meatItems:Array = [{label: "None", data: 0},
{label: "Chicken", data: 1},
{label:"Beef", data: 2},
{label: "Ham", data: 3},
{label: "Lamb", data: 4},
{label: "Pork", data: 5},
{label: "Sausages", data: 6},
{label: "Venison", data: 7},
{label: "Turkey", data: 8},
{label: "Duck", data: 9},
{label: "Fish", data: 10}];
I want to loop through each item in this array and insert it into a scrolling list by filling the TextField's .text property with that particular item.
var i:Number;
for (i=0; i < meatItems.length; i++) {
itemTextField.text = meatItems[i].toString();
_item = new Item();
_item.addChild(_itemTextField);
_item.y = i * _itemPosition;
}
Very simple I know, but I have been working on this for ages, and have not found any answers
At the minute, when I run it, it only displays one item and it says [object Object] instead of the text
EDIT: I have realised that I need to put _itemTextField.text = meatItems[i].label.toString(); to fix the text issue, but it still only displays one item, what is wrong with my loop?