# Eror logic help

**URL:** <https://forum.kirupa.com/t/eror-logic-help/287171>\
**Category:** Uncategorized\
**Created:** [April 27, 2009, 3:18pm UTC](https://forum.kirupa.com/t/eror-logic-help/287171 "2009-04-27T15:18:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![emolen](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@emolen](https://forum.kirupa.com/u/emolen)\
**Post date:** [April 27, 2009, 3:18pm UTC](https://forum.kirupa.com/t/eror-logic-help/287171/1 "2009-04-27T15:18:37Z")

</div>

I’m getting this error:  
Error #2025: The supplied DisplayObject must be a child of the caller

I’ve read about it here and on other forums, but have not come across the same situation I am in, I fixed it but am just looking for clarity:

I create 3 containers, one for a slideshow that gets masked by graphics, another that contains the navigation, and a 3rd that contains the content the navigation will load. I create the slideshow container and it’s mask, then I create the nav container, then later I create the content container. I want to removeChild(contentContainer) after I choose a second navigation item or just want to clear the content. Simple, and it works fine, done it a million times.

THEN: I want the contentContainer to have an index number between the slideshow and the navigation containers. I set the slideshow container index to 0, then the content container index to 1, (and I’ve tried a number of other combinations) and I am no longer able to remove content container beacuse of the error that gets thrown above. In fact any combination of setting the content container to anything other then 0 will throw this error. Why would this be?

The only answer was to set the content container index to 0, then set the slideshow index to 0

works:  
setChildIndex(contentContainer,0);  
setChildIndex(slideshowContainer,0);  
function mouseUP(e.Event){ removeChild(contentContainer):}

does not work:  
setChildIndex(contentContainer,1); // tried setting to 1,2,3,4,99,etc  
function mouseUP(e.Event){ removeChild(contentContainer);}

does not work:  
setChildIndex(contentContainer,1); // tried setting to 1,2,3,4,99,etc  
setChildIndex(slideshowContainer,0);  
function mouseUP(e.Event){ removeChild(contentContainer);}

thanks!
