开发者

Select a tab in a TabNavigator in a new state

开发者 https://www.devze.com 2022-12-19 04:42 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消