That could be it.

Try lineChart.parent.removeChild(lineChart) and see if you get a NPE on
parent :)

On Tue, Aug 5, 2008 at 9:31 AM, Alex Harui <[EMAIL PROTECTED]> wrote:

>  Maybe you ran that code twice?
>
>  ------------------------------
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *blc187
> *Sent:* Monday, August 04, 2008 12:11 PM
> *To:* [email protected]
> *Subject:* [flexcoders] error: DisplayObject must be a child of the caller
>
>  I have a chart on stage that is attached to a VBox with a few other
> components underneath.
>
> I want to remove the VBox but keep the chart. So I'm doing:
>
> var myChart:LineChart = vbox.removeChild(lineChart) as LineChart;
> this.addChild(myChart);
> this.removeChild(vbox);
>
> <mx:VBox id="vbox">
> <mx:LineChart id="lineChart" />
> <mx:HBox>
> ..... other components .....
> </mx:HBox>
> </mx:VBox>
>
> However, I get the following error:
> ArgumentError: Error #2025: The supplied DisplayObject must be a
> child of the caller.
> at flash.display::DisplayObjectContainer/removeChild()
>
> I know that removeChild() it is complaining about is vbox.removeChild
> (lineChart), because I commented out this.removeChild(vbox) and still
> get the error.
>
> I also know that the removeChild call works fine because I see the
> LineChart in the var myChart when I put a breakpoint on it.
> Any thoughts on why it might be complaining?
>
> 
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to