1. Problem background
There are four tabs for hiding and displaying tabs based on different parameters.
2. Implementation instance
(1) Hide "Spring"
protected function springClickHandler(event:MouseEvent):void{tabs.getTabAt(0).visible = false;tabs.getTabAt(0).includeInLayout = false;tabs.getTabAt(1).visible = true;tabs.getTabAt(1).includeInLayout = true;tabs.getTabAt(2).visible = true;tabs.getTabAt(2).includeInLayout = true;tabs.getTabAt(3).visible = true;tabs.getTabAt(3).includeInLayout = true;tabs.selectedIndex = 1;}
(2) Hide "Summer"
protected function summerClickHandler(event:MouseEvent):void{tabs.getTabAt(0).visible = true;tabs.getTabAt(0).includeInLayout = true;tabs.getTabAt(1).visible = false;tabs.getTabAt(1).includeInLayout = false;tabs.getTabAt(2).visible = true;tabs.getTabAt(2).includeInLayout = true;tabs.getTabAt(3).visible = true;tabs.getTabAt(3).includeInLayout = true;tabs.selectedIndex = 0;}
(3) Hide "Autumn"
protected function autumnClickHandler(event:MouseEvent):void{tabs.getTabAt(0).visible = true;tabs.getTabAt(0).includeInLayout = true;tabs.getTabAt(1).visible = true;tabs.getTabAt(1).includeInLayout = true;tabs.getTabAt(2).visible = false;tabs.getTabAt(2).includeInLayout = false;tabs.getTabAt(3).visible = true;tabs.getTabAt(3).includeInLayout = true;tabs.selectedIndex = 0;}
(4) Hide "Winter"
protected function winterClickHandler(event:MouseEvent):void{tabs.getTabAt(0).visible = true;tabs.getTabAt(0).includeInLayout = true;tabs.getTabAt(1).visible = true;tabs.getTabAt(1).includeInLayout = true;tabs.getTabAt(2).visible = true;tabs.getTabAt(2).includeInLayout = true;tabs.getTabAt(3).visible = false;tabs.getTabAt(3).includeInLayout = false;tabs.selectedIndex = 0;}
(5) display "Four Seasons"
protected function fourClickHandler(event:MouseEvent):void{tabs.getTabAt(0).visible = true;tabs.getTabAt(0).includeInLayout = true;tabs.getTabAt(1).visible = true;tabs.getTabAt(1).includeInLayout = true;tabs.getTabAt(2).visible = true;tabs.getTabAt(2).includeInLayout = true;tabs.getTabAt(3).visible = true;tabs.getTabAt(3).includeInLayout = true;tabs.selectedIndex = 0;}
3. instance result
(1) initialization
(2) Click "Spring ".
(3) Click "Summer ".
(4) Click "Autumn ".
(5) Click "Winter ".
(6) Click "Four Seasons ".
Hide and display tabs of tabnavigator In Flex