PDA

View Full Version : dynamic variable names


djrogi
02-28-2008, 07:17 AM
I may just be missing it, I'm fairly new. I have an array returned that runs through creating several canvas tags under a TabNavigation. the dataGrid in each canvas must use a separate dataProvider that is tied to the canvas id.

is there a way in the script to name my dataProviders dynamically, something like

canvas.dataProvider = [ "returnedArray" + variable ]

then do a Remote Object call to populate that dataGrid :eek:

djrogi
02-28-2008, 07:40 AM
figured out the right side, now for the left...

grid.dataProvider = '"messageList" + boxIndex';

but the same thing will not work on the left side when I pull the ArrayCollection

'"messageList" + boxIndex' = some ArrayCollection

I'll post it if I figure it out.

djrogi
03-01-2008, 07:25 AM
I think I have this solved except for one part.

what is the best way to create a child from a child.. besides waiting for them to grow up ....

private function getMessageListHandler(evnt:ResultEvent):void
{
this.messageList = new ArrayCollection( ArrayUtil.toArray(evnt.result) );
var grid:DataGrid = new DataGrid();
var col1:DataGridColumn = new DataGridColumn();
var col2:DataGridColumn = new DataGridColumn();
grid.dataProvider = this.messageList;
grid.percentHeight = 100;
grid.percentWidth = 100;
messageBoxes.selectedChild.addChild(grid);
------>need to add the DataGridColumn definitions here<-------
}

I'm just not sure how to reference them there. Any ideas?