Rad The Mad
Rad The Mad

Reputation: 640

Select a tab in a TabNavigator in a new state

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 component 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;
            }

        }

Upvotes: 0

Views: 3669

Answers (1)

Matt MacLean
Matt MacLean

Reputation: 19656

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.

Upvotes: 1

Related Questions