You haven't shown all the relevant code so it's kind of hard to guess.
But the obvious suggestion is to move your arrList declaration out of the function
and into the declarations area of the project - then make it Bindable - you need that to assign it
as a DataProvider
Sorry, the <s:TextArea shouldn't be there, I was using it to debug the array. I removed the <s:DataGrid> instead of <s:TextArea> by mistake.
Also, I tried to move arrList out of the function but that didn't work.
Here's the entire code again:
<?xml version="1.0" encoding="utf-8"?>
<!-- Place non-visual elements (e.g., services, value objects) here -->
protected function cmdStart1_clickHandler(event:MouseEvent):void
protected function DataGridTest1():void
var board:Array = ;
var arrList:ArrayList = new ArrayList();
var i:int = 1;
text.text = "";
for(i; i<=5; i++)
board[i] = ;
j = 1;
for(j; j<=6; j++)
board[i][j] = Math.round(Math.random() * 10);
arrList.source = board;
grid.dataProvider = arrList;
<s:Button id="cmdStart1" x="53" y="100" width="394" height="62" label="DataGridTest1 (ArrayList to Grid)"
<s:DataGrid id="grid" x="500" y="100" width="236" height="226" />
Like I said, I believe you need to move the arrList declaration out of the function
and make it bindable.
<fx:Declarations> [Bindable] private var arrList:ArrayList = new ArrayList(); </fx:Declarations>
Don't have flashbuilder here so I'll try that later.
Will I need to change anything in the <s:DataGrid> tag or any other place as well?
Looks like you only have one field, but I think you still need to define the one DataGridColumn - but maybe not?
I usually use ArrayCollections with named fields.
You should be able to find plenty of examples online
I also believe you need to define the datagrid columns.