You could have a function that loops through the tabs to see if the tab already exists and if it does set the tabNavigators selectedIndex, if it doesnt add the new tab
var tabFound:Boolean = false;
for(var i:int = 0; i < myTabNavigator.numChildren; i++)
{
if(myTabNavigator.getChildAt(i) is myNewObj)
{
myTabNavigator.selectedIndex = i;
tabFound = true;
break;
}
}
if(!tabFound)
{
myTabNavigator.addChild(myNewObj);
}
I quickly wrote that code up and didnt test it, but the logic would be similar.
Chris Klepeis
2009-07-04 22:28:59