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; }
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; }
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; }
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; }
(1)初始化
<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PC9wPgo8cD6jqDKjqbXju/ehsLS6vL6hsbC0xaU8L3A+CjxwPjxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/Collfiles/20141029/20141029085656137.png" width="710" height="392" border="1" alt="\">
(3)點擊“夏季”按鈕
(4)點擊“秋季”按鈕
(5)點擊“冬季”按鈕
(6)點擊“四季”按鈕