just let me clarify me statment is an opinion but i really dont know why it 
doesnt get set at the beginning but this works



----- Original Message ----
From: Sherif Abdou <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Thursday, March 6, 2008 11:03:05 PM
Subject: Re: [flexcoders] TabNavigator weirdness

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:WindowedApplicat ion xmlns:mx="http://www.adobe. com/2006/ mxml" 
layout="vertical" xmlns:lib="com.lib.*">
<mx:Script>
<![CDATA[
import mx.events.IndexChan gedEvent;
import mx.events.ChildExis tenceChangedEven t;
import mx.containers. VBox;
 
private function rest():void{
myTab.removeAllChil dren();
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( IndexChangedEven t.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:WindowedApplica tion>



----- Original Message ----
From: dbronk <[EMAIL PROTECTED] com>
To: [EMAIL PROTECTED] ups.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







Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. 
 


      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to