Sending textarea text to datagrid as object
I would like a text area that holds multiple strings to send its values to an array and the array to convert the string to an object. The objects then populate a datagrid. I can't really figure out where to go from here:
var arrayString:String = myTextArea.text;
var newArray:Array = arrayString.split(",");
var n:int=newArray.length;
while (n--)
{
newArray[n]=Number(newArray[n])
开发者_如何学Go var obj:Object = new Object();
obj.label = newArray[n];
this.myDataGrid.addItem(obj );
}
var arrayString:String = myTextArea.text;
var newArray:Array = arrayString.split(",");
var n:int=newArray.length;
var dataProvider:ArrayCollection = new ArrayCollection;
while (n--)
{
newArray[n]=Number(newArray[n])
var obj:Object = { label: newArray[n] };
dataProvider.addItem(obj);
}
this.myDataGrid.dataProvider = dataProvider;
精彩评论