Flex TabNavigator页间跳转

来源:互联网 发布:java教程pdf 编辑:程序博客网 时间:2024/05/22 14:30
protected function gotoCustomerDetails():void{//法一:通过循环遍历寻找,然后跳转for each (var childTab:VBox in tabNav.getChildren()){   if(childTab.label == "页面三"){//只是通过标签名字判断.如果一样就直接打开标签.   tabNav.selectedIndex = tabNav.getChildIndex(childTab);}   } //法二:直接跳转tabNav.selectedIndex=2;}<mx:TabNavigator id="tabNav" styleName="TabNavigator" width="100%" height="100%" change="tabNav_changeHandler(event)"><!--页面一--><mx:VBox label="页面一" width="100%" height="100%"><mx:ApplicationControlBar width="100%" styleName="topBar" height="35" paddingTop="5" paddingBottom="5"><mx:HBox cornerRadius="5"><mx:Label text="数据周期:" styleName="myLabel" fontSize="12"/><calendar:MonthField id="predictMonth" styleName="myCalender" /><mx:Button label="查 询" width="66" height="24" styleName="myButton" click="searchClick()"/><mx:Button label="接触偏好分析" width="106" height="24" styleName="myButton" click="gotoChannelPreferences()"/><mx:Button label="客户明细查看" width="106" height="24" styleName="myButton" click="gotoCustomerDetails()"/></mx:HBox></mx:ApplicationControlBar></mx:VBox><!--页面二--><mx:VBox label="页面二" width="100%" height="100%"><mx:ApplicationControlBar width="100%" styleName="topBar" height="35" paddingTop="5" paddingBottom="5"><mx:HBox cornerRadius="5"><mx:Label text="数据周期:" styleName="myLabel" fontSize="12"/><calendar:MonthField id="actionMonth" styleName="myCalender" /></mx:HBox></mx:ApplicationControlBar></mx:VBox><!--页面三--><mx:VBox label="页面三" width="100%" height="100%"><mx:ApplicationControlBar width="100%" styleName="topBar" height="70" paddingTop="5" paddingBottom="5"></mx:ApplicationControlBar></mx:VBox></mx:TabNavigator>