In a script I iterate through a collection, making new TileLists as we
go along. I name these tilelist's so I can access them later.
Snip #1
for (var i:int=0; i<dp.length;i++) {
// First we make a new tabbar for the
tiles
var newTB:TabNavigator = new
TabNavigator();
newTB.id = 'tabnav'+ dp[i].id;
newTB.percentWidth = 100;
newTB.height = 200;
// Then we make a canvas to hold the
items
var newCV:Canvas = new Canvas();
newCV.id = 'canvas'+ dp[i].id;
newCV.percentWidth = 100;
newCV.label = dp[i].orgname;
// Then we make a new TileList
var newTL:TileList = new TileList();
newTL.id = 'tilelist'+ dp[i].id;
newTL.name = 'tilelist'+ dp[i].id;
trace('create:tilelist'+ dp[i].id);
newTL.percentWidth = 100;
newTL.itemRenderer = new ClassFactory(
projectTile );
newTL.dataProvider = null;
newCV.addChild( newTL );
newTB.addChild( newCV );
pageOverviewVBox.addChild( newTB );
g_fileid = dp[i].id;
ds_getpages.send();
}
// End snip #1
For each of these items, I call a httpservice to get the pages that
belong to that file (ds_getpages.send())
>From the data returned I can calculate the name of the tilelist where
I'd like to show the data. See Snip #2
{
var rawData:String = String(event.result);
var arr:Array = (JSON.decode(rawData) as Array);
var dp:ArrayCollection = new
ArrayCollection(arr);
//projectPages = dp;
var fileid:int = dp[0].fileid;
trace( 'tilelist'+fileid as TileList);
//(('tilelist'+ fileid.toString()) as
TileList).dataProvider = dp;
<- Fails with a NULL error, can't access a null object...
}
So.. please help me out here - how can I access a object, which
name/id I know - I just cant figure this out. Propably doing this all
wrong - but this is what I could think up.
Thanks for your time (if you made it all the way down here)
Mark