我有一个TabNavigator组件,它在运行时添加其子组件时没有显示它们。
有绕过这个的路吗?
我目前正在做以下工作:
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;抱歉伙计们没有给出足够的细节。tabNavigator位于一个HBox容器中,我没有添加代码,因为我认为它不相关。
在上面的代码中,我用SimpleComponent替换了MyComponent。MyComponent只是另一个具有文本字段和标签的HBox。
谢谢。
发布于 2010-08-23 22:16:25
试着把这个:
tabNavigator.addChild(myComponent);
tabNavigator.selectedChild = 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;https://stackoverflow.com/questions/3549985
复制相似问题