程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> Flex中TabNavigator隱藏和顯示選項卡

Flex中TabNavigator隱藏和顯示選項卡

編輯:C++入門知識

Flex中TabNavigator隱藏和顯示選項卡


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)初始化

\

<喎?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)點擊“四季”按鈕


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved