If your application has a VBox and Vbox has a child Button, to delete that
button, it SHOULDN'T BE this.removeChild(buttonId); Instead it should be
vboxId.removeChild(buttonId);
This can be the reason for that error in your case. Also, as Alex told, try to
see the numChildren and also see which are the children of your application.
eg. for(var i:int=0;i < numChildren;i++) {
trace(getChildAt(i));
}
Thanks,
Shameer
--- In [email protected], Alex Harui <aha...@...> wrote:
>
> It depends on what the MXML looks like and whether you've added any other
> children dynamically. See if you can get that test case to show the problem.
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of jmfillman
> Sent: Wednesday, September 09, 2009 10:19 AM
> To: [email protected]
> Subject: [flexcoders] Re: The supplied DisplayObject must be a child of the
> caller
>
>
>
> Even though this.numChildren returns 7, this.removeChildAt(5) removes the
> correct child. It works, but I'm a bit confused.
>
> --- In [email protected]<mailto:flexcoders%40yahoogroups.com>,
> "jmfillman" <jmfillman@> wrote:
> >
> > this.numChildren returns 7
> >
> > Will work on a sample app to demonstrate.
> >
> >
> > --- In [email protected]<mailto:flexcoders%40yahoogroups.com>,
> > Alex Harui <aharui@> wrote:
> > >
> > > Maybe publish a full test case in 20 lines or so. What is
> > > this.numChildren?
> > >
> > > Alex Harui
> > > Flex SDK Developer
> > > Adobe Systems Inc.<http://www.adobe.com/>
> > > Blog: http://blogs.adobe.com/aharui
> > >
> > > From: [email protected]<mailto:flexcoders%40yahoogroups.com>
> > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>]
> > > On Behalf Of jmfillman
> > > Sent: Tuesday, September 08, 2009 10:11 PM
> > > To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> > > Subject: [flexcoders] The supplied DisplayObject must be a child of the
> > > caller
> > >
> > >
> > >
> > > So I'm trying to remove a child from a canvas container.
> > >
> > > trace (this.getChildAt(6));
> > > this.removeChild(this.getChildAt(6));
> > > this.removeChildAt(6);
> > >
> > > The trace statement returns the path to the correct child, but when I try
> > > removeChild() or removeChildAt(), I get:
> > >
> > > The supplied DisplayObject must be a child of the caller
> > > at flash.display::DisplayObjectContainer/getChildIndex()
> > >
> > > Why???
> > >
> >
>