How to open a new tab on button click

851 Views Asked by At

I have a tab navigator which contains the 4 tabs Account, Configuration, System and Dashboard. In the Configuration tab there is a button labeled add new config. If the user clicks this button the system tab should open - how to do this?

1

There are 1 best solutions below

4
On BEST ANSWER
<mx1:TabNavigator width="50%" height="50%" id="tabnav">

    <mx1:VBox label="Account" width="20%" height="20%">

    </mx1:VBox>
    <mx1:VBox label="Configuration" width="20%" height="20%">
        <s:Button id="c" click="c_clickHandler(event)" label="new config"/>
    </mx1:VBox>
    <mx1:VBox label="System" width="20%" height="20%">

    </mx1:VBox>
    <mx1:VBox label="Dash board" width="20%" height="20%">

    </mx1:VBox>

</mx1:TabNavigator>


protected function c_clickHandler(event:MouseEvent):void
   {
     tabnav.selectedIndex = 2;
   }