tabNavigator selectedIndex not working
I have reduced a problem I'm having to a very simple example. I'm using the
routine in a validation of form, trying to make sure they don't leave the
current tab index if a form is 'open.' It works the first time but after that,
does not work every other time. Suggestions?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function resetTab():void{
tabNav.selectedIndex = 0;
Alert.show("selected child should be tab1 but it's " +
tabNav.selectedChild);
}
]]>
</mx:Script>
<mx:TabNavigator id="tabNav" x="48" y="35" width="200" height="200"
change="resetTab();">
<mx:Canvas label="Tab 1" width="100%" height="100%" id="tab1">
</mx:Canvas>
<mx:Canvas label="Tab 2" width="100%" height="100%" id="tab2">
</mx:Canvas>
</mx:TabNavigator>
</mx:Application>
|