开发者

TabNavigator not showing children

I have a TabNavigator component which is not showing its children when adding them at runtime.

Is there a way around this please?

I'm doing the following at the moment:

var tabNavigator:TabNavigator = new TabNavigator();

// etc.

parentHBoxContainer.addChild(tabNavigator);

 // etc.

// Custom component with nothing special in it

// Trigger on a button click (Add)
var myComponent:MyComponent = new MyComponent();

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;

Sorry guys for not giving enough details. The tabNavigator is inside an HBox container, I didn't add the code because I thought it would be irrelevant.

开发者_运维问答

I replaced SimpleComponent by MyComponent in the code above. MyComponent is just another HBox with a textfield and a label.

Thanks.


Try to put this:

tabNavigator.addChild(myComponent);

tabNavigator.selectedChild = myComponent;

instead of this:

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜