Flex中TabNavigator隱藏和顯示選項卡,flextabnavigator
1、問題背景
遇到這樣一個問題:有四個Tab選項卡,根據不同的參數隱藏和顯示選項卡
2、實現執行個體
(1)隱藏“春季”
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)隱藏“夏季”
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)隱藏“秋季”
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)隱藏“冬季”
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)顯示“四季”
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、執行個體結果
(1)初始化
(2)點擊“春季”按鈕
(3)點擊“夏季”按鈕
(4)點擊“秋季”按鈕
(5)點擊“冬季”按鈕
(6)點擊“四季”按鈕
flex tabnavigator中的選項卡太多怎多行顯示,或者有左右箭頭
我也想知道
flex中TabNavigator選項卡中,點擊按鈕,使之互換的代碼
TabNavigator定義ID為tabSth
點擊按鈕時 : this.tabSth.selectedIndex = 0;
0表示第一個選項卡,1表示第二個 選項卡