【问题标题】:How to access the inner container inside the Scroller?如何访问 Scroller 内部的内部容器?
【发布时间】:2014-03-22 14:49:18
【问题描述】:

我有一个容器

<s:Group visible="true" x="100" y="0" width="582" height="300" 
    id="debugGroup" name="debugGroupName" >
        <comps:circle id="rect2" />
        <s:Rect width="100" height="100">
            <s:fill><s:SolidColor /></s:fill>
        </s:Rect>
</s:Group>

到目前为止,我从我的其他班级访问它是这样的:

FlexGlobals.topLevelApplication.debugGroup.addElement(comp_green_new_component);

我想滚动我的 debugGroup 容器,所以我添加了一个 Scroller。

<s:Scroller width="100%" height="100%" id="scrollerDebug">
    <s:Group visible="true" x="100" y="0" width="582" height="300" 
    id="debugGroup" name="debugGroupName" >
        <comps:circle id="rect1" />
        <comps:circle id="rect2" />
        <s:Rect width="100" height="100">
            <s:fill><s:SolidColor /></s:fill>
        </s:Rect>
</s:Group>
</s:Scroller

现在我无法像这样从其他类访问我的 debugGroup:

FlexGlobals.topLevelApplication.scrollerDebug.debugGroup.addElement(comp_green);

这是为什么? 如何从 actionscript 正确访问我的内部容器 debugGroup?

【问题讨论】:

    标签: actionscript-3 apache-flex


    【解决方案1】:

    如果你有它的 id,你不需要给出元素的完整路径

    所以替换

    FlexGlobals.topLevelApplication.scrollerDebug.debugGroup.addElement(comp_green);
    

    FlexGlobals.topLevelApplication.debugGroup.addElement(comp_green);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-29
      • 2014-02-04
      相关资源
      最近更新 更多