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

Flex中TabNavigator隐藏和显示选项卡

(2)点击“春季”button

Flex中TabNavigator隐藏和显示选项卡


(3)点击“夏季”button

Flex中TabNavigator隐藏和显示选项卡


(4)点击“秋季”button

Flex中TabNavigator隐藏和显示选项卡


(5)点击“冬季”button

Flex中TabNavigator隐藏和显示选项卡


(6)点击“四季”button

Flex中TabNavigator隐藏和显示选项卡

相关文章:

  • 2021-07-14
  • 2021-05-22
  • 2022-12-23
  • 2021-11-19
  • 2021-04-21
  • 2021-11-02
  • 2021-09-25
  • 2021-11-03
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案