# Dynamic ComboBox is giving negative depth to attached MovieClip?

**URL:** https://forum.kirupa.com/t/dynamic-combobox-is-giving-negative-depth-to-attached-movieclip/229488
**Category:** Uncategorized
**Created:** [June 17, 2007, 11:33pm UTC](https://forum.kirupa.com/t/dynamic-combobox-is-giving-negative-depth-to-attached-movieclip/229488 "2007-06-17T23:33:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DavidOrtiz](https://avatars.discourse-cdn.com/v4/letter/d/e480ec/32.png) [@DavidOrtiz](https://forum.kirupa.com/u/DavidOrtiz)
#### Post date: [June 17, 2007, 11:33pm UTC](https://forum.kirupa.com/t/dynamic-combobox-is-giving-negative-depth-to-attached-movieclip/229488/1 "2007-06-17T23:33:13Z")

</div>

Hi guys, I’ve got this new problem where I’m trying to remove a container movieclip i’ve attached the first time the function is run, but I try to remove it and replace it again, but the second time around it gets a negative depth and all goes to hell. any ideas??

```auto

function populateBasket(){
    trace("B4 REMOVE:" + basketRows.loader.container.getDepth());        
     basketRows.loader.container.removeMovieClip();

    trace("AFTER REMOVE:" + basketRows.loader.container.getDepth());    
    basketRows.loader.attachMovie("~container","container", 0);

    trace("AFTER ATTACH:" + basketRows.loader.container.getDepth());   

    for(i=0;i<items.length;i++){
       var myMC = basketRows.loader.container.attachMovie("~basket_row","row" + i, i);
       myDropDown = myMC.cbcontainer.attachMovie("ComboBox","qtyCB", 0);
       myDropDown.setSize(43,22);
       myDropDown.addItem({label: "1", data: 1});
    }
};
                                    
populateBasket();

mybtn.onPress = function(){
    populateBasket();
};

```

output when swf loads:  
B4 REMOVE:undefined  
AFTER REMOVE:undefined  
AFTER ATTACH:0

output when I press the button:  
B4 REMOVE:0  
AFTER REMOVE:-32769  
AFTER ATTACH:-32769
