Setting the id this way is not the same as setting an id="myId" in an mxml tag. In that case the generator/compiler creates an instance variable with the name specified in the id property containing a reference to the component.
When creating children yourself, you need to build your own list of references. One way is using an object (associative array) _oTBArray['tabnav'+ dp[i].id] = newTB; Then access it: var tbCurrent:TabNavigator = _oTBArray['tabnav'+ dp[i].id]; Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of oneproofdk Sent: Wednesday, October 17, 2007 8:02 AM To: [email protected] Subject: [flexcoders] How to access objects made by a script (addChild) 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

