【问题标题】:TabNavigator not showing childrenTabNavigator 不显示子项
【发布时间】:2011-04-02 18:35:31
【问题描述】:

我有一个 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 替换为 MyComponentMyComponent 只是另一个带有文本字段和标签的 HBox

谢谢。

【问题讨论】:

  • 使用当前代码 sn-p,标签导航器永远不会添加为其组件的父级。我不确定这是否是您复制和粘贴位置的副作用或实际代码的问题。如果您能提供我们可以运行的完整代码;这将是有益的。
  • SimpleComponent 是 Spark 组件吗?如果没有一些 Halo 容器包装器,则无法将 Spark 组件添加到 TabNavigator 子级。

标签: apache-flex flex3


【解决方案1】:

试着这样说:

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;

【讨论】:

    猜你喜欢
    • 2018-10-02
    • 1970-01-01
    • 2017-12-19
    • 2020-01-08
    • 1970-01-01
    • 2019-08-14
    • 2017-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多