Greetings,
I am trying to figure out how to get the TabNavigator to create it's
children so they are accessible after I add the TabNavigator to it's
parent through addChild(). However, I am getting an index out of
bounds error because the TabBar children have not been created yet.
Does anyone know how I can force creation of the TabBar children so I
can assess them immediately?
Below is an example of the code that show my problem.
Thanks,
-Mark
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
verticalGap="0" xmlns:local="*" height="100%" initialize="addTabs()" >
<mx:Script>
<![CDATA[
import mx.containers.Box;
import mx.containers.TabNavigator;
private function addTabs(): void {
var tn:TabNavigator = new TabNavigator();
var box:Box = new Box();
box.label = "1";
tn.addChild( box );
box = new Box();
box.label = "2";
tn.addChild( box );
box = new Box();
box.label = "3" ;
tn.addChild( box );
box = new Box();
box.label = "4";
tn.addChild( box );
addChild( tn );
trace( tn.getTabAt( 3 ) );
}
]]>
</mx:Script>
</mx:Application>