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; }
(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; }
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)初始化
(2)点击“春季”按钮
(3)点击“夏季”按钮
(4)点击“秋季”按钮
(5)点击“冬季”按钮
(6)点击“四季”按钮
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。