Let's say I have some basic MXML setup as follows:
<Item id="parent">
<Frame>
<mx:Image/>
</Frame>
</Item>
How can I refer to an attribute of the Image element by referring to it as a grandchild (child of a child) of the parent Item? I've tried daisy-chaining two calls to getChildAt(), i.e.:
parent.getChildAt(0).getChildAt(0)
But I get the following error:
Error: Call to a possibly undefined method getChildAt through a reference with static type flash.display:DisplayObject.
What is the proper way to make a call to a grandchild element?
getChildAt()
function returns a DisplayObject
So you must be type cast as follows.
DisplayObjectContainer(parent.getChildAt(0)).getChildAt(0)