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



(2)点击“春季”按钮



(3)点击“夏季”按钮



(4)点击“秋季”按钮



(5)点击“冬季”按钮



(6)点击“四季”按钮


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值