zoukankan      html  css  js  c++  java
  • 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)点击“春季”button



    (3)点击“夏季”button



    (4)点击“秋季”button



    (5)点击“冬季”button



    (6)点击“四季”button


  • 相关阅读:
    cookie,sessionStorage,localStorage
    存储方式与传输方式
    为什么css放在顶部而js写在后面
    常见的web安全及防护原理
    web缓存
    http协议理解
    http与https
    get/post的区别
    JZOJ 3571. 【GDKOI2014】内存分配
    JZOJ 3570. 【GDKOI2014】壕壕的寒假作业
  • 原文地址:https://www.cnblogs.com/claireyuancy/p/7172410.html
Copyright © 2011-2022 走看看