flex TabNavigator 切换触发事件
非常感谢这们兄弟
http://www.cnblogs.com/yansheng9988/archive/2009/06/10/1500742.html
<mx:TabNavigator width="100%" height="100%" id="tabMain"> <ercc:Expert id="tabExpert" label="专家" width="100%" height="100%"> </ercc:Expert> <ercc:Team id="tabTeam" label="队伍" width="100%" height="100%"> </ercc:Team> </mx:TabNavigator>
private function initTab() : void
{
var btn:Button;
for(var i:int=0;i<tabMain.getChildren().length;i++)
{
btn = tabMain.getTabAt(i);
btn.addEventListener(MouseEvent.MOUSE_DOWN,tabClickHandler,false,999999999);
}
}
private function tabClickHandler(event:MouseEvent):void
{
var iTabIndex:int = event.currentTarget.parent.getChildIndex(event.currentTarget);
//终止事件
event.stopImmediatePropagation();
//给出提示message
if(iTabIndex != 1 && currentState == "teamAdd")
{
Alert.okLabel="确定";
Alert.show("队伍处理未完成","提示信息");
tabMain.selectedIndex = 1;
}
else
tabMain.selectedIndex = iTabIndex;
}

浙公网安备 33010602011771号