Actionscript 3 ActionScript对孙子(子元素的子元素)元素的引用

Actionscript 3 ActionScript对孙子(子元素的子元素)元素的引用,actionscript-3,parent-child,mxml,grandchild,Actionscript 3,Parent Child,Mxml,Grandchild,假设我有一些基本的MXML设置,如下所示: <Item id="parent"> <Frame> <mx:Image/> </Frame> </Item> 但我得到了以下错误: Error: Call to a possibly undefined method getChildAt through a reference with static type flash.display:DisplayOb

假设我有一些基本的MXML设置,如下所示:

<Item id="parent">
    <Frame>
        <mx:Image/>
    </Frame>
</Item>
但我得到了以下错误:

Error: Call to a possibly undefined method getChildAt through a reference with static type flash.display:DisplayObject.
调用孙子元素的正确方法是什么?

getChildAt()
函数返回一个DisplayObject

因此,您必须按如下方式进行类型转换

DisplayObjectContainer(parent.getChildAt(0)).getChildAt(0)

您可能必须将其转换为
电影剪辑
。谢谢,这非常有效,现在我明白了错误的含义
DisplayObjectContainer(parent.getChildAt(0)).getChildAt(0)