this works, dispatch a fake event and change it, what happens is the TabNavigator either loses focus or the children are not garbage collected until there is a click or some form of interaction with it <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:lib="com.lib.*"> <mx:Script> <![CDATA[ import mx.events.IndexChangedEvent; import mx.events.ChildExistenceChangedEvent; import mx.containers.VBox;
private function rest():void{ myTab.removeAllChildren(); for(var i:int=0;i<5;i++) { var v:VBox = new VBox(); v.label="Tab" +String(i); myTab.addChild(v); } myTab.dispatchEvent(new IndexChangedEvent(IndexChangedEvent.CHANGE)); myTab.selectedIndex=0; } ]]> </mx:Script> <mx:TabNavigator id="myTab" width="400" height="500"> <mx:VBox label="Tab1"/> <mx:VBox label="Tab21"/> <mx:VBox label="Tab3"/> <mx:VBox label="Tab4"/> </mx:TabNavigator> <mx:Button label="Reset" click="rest()"/> </mx:WindowedApplication> ----- Original Message ---- From: dbronk <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Thursday, March 6, 2008 10:32:24 PM Subject: [flexcoders] TabNavigator weirdness I have a TabNavigator component that I completely reset the tabs dynamically with the following code: tabNav.removeAllChi ldren(); for each (var container:Container in myList ) { tabNav.addChild( container) } tabNav.selectedInde x = 0; So this successfully removes the existing tabs, then loops though my ArrayCollection and adds a new set of tabs. It also shows the contents of tabNav[0], but the tab that displays as selected is whatever was currently selected. So if I originally displayed the tabnav and clicked the 3rd tab, then clicked the button completely outside of the tabnav that causes it to redisplay, it will correct show the contents of tabnav[0], but visually it looks like the 3rd tab is still selected. I also tried tabNav.validateNow( ) and it doesn't work. To test I added a button completely outside of the tabnav with click="tabnav. selectedIndex= 0", works great. So what am I not doing? Thanks, Dale ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs