You get the message because getChildAt returns a DisplayObject which does
not have a getChildAt method (that's what the error message is saying). You
have first to cast the object returned from the first getChildAt call to a
DisplayObjectContainer or a subclass of it (in your case it's a VBox). There
are different ways to do it, one way would be:
var theVidButton:VBox = (vidButtonBox.getChildAt(0) as VBox).getChildAt(0)
as VBox;
You must make sure that vidButtonBox.getChildAt(0) will return a VBox
otherwise you will get an exception! It's better to do something like this:
var theVidButton:VBox = null;
var vidButtonContainer:VBox = vidButtonBox.getChildAt(0) as VBox;
if (vidButtonContainer != null)
{
theVidButton = vidButtonContainer.getChildAt(0) as VBox;
}
if (theVidButton == null)
{
//something went wrong
}
Hope it helps!
On Sat, Oct 4, 2008 at 4:51 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have a VBox in mxml called vidButtonBox
> <mx:VBox id="vidButtonBox" height="435" width="215"
> styleName="vidButtonBoxStyle" paddingLeft="10" paddingRight="10" >
> </mx:VBox>
>
> In action script, I create a VBox with a Vbox child
> var vidArea:VBox = new VBox;
> var vidButton:VBox=newBbox;
> vidArea.addChild(vidButton);
>
> then add that to the mxml Box
> vidButtonBox.addChild(vidArea);
>
> Then I try to access the children
> var theVidButton:VBox= vidButtonBox.getChildAt(0).getChildAt(0);
>
> And I get this error:
> K:\xampp\htdocs\jbh\Main.mxml(145): Error: Call to a possibly undefined
> method getChildAt through a reference with static type
> flash.display:DisplayObject.
>
> This makes no sense at all. What is going on here ? How do I access
> child[0].child[0]?
>
>
>
--
Haykel Ben Jemia
Allmas
Web & RIA Development
http://www.allmas-tn.com