in my case I click a button. it calls changeTabState() ; it changes the state and then needs to select a tab using selectedIndex. but that does not work properly. If i go back go the main state and click the button again, it works as it should. Help! What should I do 'register' the tab navigator co开发者_开发知识库mponent in my new state?
Button:
<mx:Button x="741" y="21" label="Upload" click="changeTabState('login');" visible="{loggedIn}"/>
Function:
public function changeTabState(tabName):void {
currentState='tools'; //changes my state to 'tools'
trace(tabName);
if (tabName == "login") {
trace(tabName);
toolsTabs.selectedIndex=4;
} else if (tabName == "upload") {
toolsTabs.selectedIndex=3;
}
}
On your tab navigator, try setting creationPolicy="true". It may be that the tab you are trying to switch to has not yet been created.
精彩评论