removeChild

Wow, this question is so basic, I almost don’t want to ask it. I have an object I place in a container, when the container hits my ship, I want to remove the object, however I get the message
display object must be the child of the caller, please see code:

//DISPLAY BLACK HOLE ICON
ActionScript Code:
[LEFT][COLOR=#0000FF]public[/COLOR] [COLOR=#000000]function[/COLOR] displayBlackHoleIconCOLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
myBlackHoleIconContainer = [COLOR=#000000]new[/COLOR] SpriteCOLOR=#000000[/COLOR]
myBlackHoleIconContainer.[COLOR=#000080]x[/COLOR] = randomXCOLOR=#000000[/COLOR];

        [COLOR=#0000FF]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i:[COLOR=#0000FF]int[/COLOR] = [COLOR=#000080]0[/COLOR]; i < [COLOR=#000080]200[/COLOR]; i++[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
            myBlackHoleIcon = [COLOR=#000000]**new**[/COLOR] BlackHoleIcon[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
            myBlackHoleIcon.[COLOR=#000080]x[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]random[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]* [COLOR=#000080]30[/COLOR] + [COLOR=#000080]20[/COLOR];
            myBlackHoleIcon.[COLOR=#000080]y[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]random[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]* [COLOR=#000080]30[/COLOR] + [COLOR=#000080]20[/COLOR];
            
            myBlackHoleIconContainer.[COLOR=#000080]addChild[/COLOR][COLOR=#000000]([/COLOR]myBlackHoleIcon[COLOR=#000000])[/COLOR];
            [COLOR=#000000]}[/COLOR]
        
        blackHoleIconArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR]myBlackHoleIconContainer[COLOR=#000000])[/COLOR];
        addChild[COLOR=#000000]([/COLOR]myBlackHoleIconContainer[COLOR=#000000])[/COLOR];
        

        [COLOR=#000000]}[/COLOR]

[COLOR=#808080]//BLACK HOLE ICON VS FALCON[/COLOR]
[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] blackHoleNum:[COLOR=#0000FF]int[/COLOR]=blackHoleIconArray.[COLOR=#0000FF]length[/COLOR] - [COLOR=#000080]1[/COLOR]; blackHoleNum >= [COLOR=#000080]0[/COLOR]; blackHoleNum–[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]

                [COLOR=#808080]*/*playSound(shipHit);*/*[/COLOR]
                removeChild[COLOR=#000000]([/COLOR]myBlackHoleIconContainer[COLOR=#000000])[/COLOR];
                addDisplayBlackHoleIcon[COLOR=#000000]([/COLOR]displayBlackHoleIconCount,[COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
                isBlackHolePowerActive = [COLOR=#000000]**true**[/COLOR];
                


            [COLOR=#000000]}[/COLOR]
        [COLOR=#000000]}[/COLOR]

[/LEFT]

am i reading this right - you want to remove the object, not the container? if so is your removeChild right? it’s referencing the container and not the object?

I want to remove the container which will in return remove what ever is inside it

amazing, thanks!