# Remove attached MovieClip

**URL:** <https://forum.kirupa.com/t/remove-attached-movieclip/215427>\
**Category:** flash\
**Created:** [February 7, 2007, 8:04am UTC](https://forum.kirupa.com/t/remove-attached-movieclip/215427 "2007-02-07T08:04:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mochachino](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@Mochachino](https://forum.kirupa.com/u/Mochachino)\
**Post date:** [February 7, 2007, 8:04am UTC](https://forum.kirupa.com/t/remove-attached-movieclip/215427/1 "2007-02-07T08:04:54Z")

</div>

Hi all

Could anyone help me to unload the attached movieClip when I use loadMovie to load a new clip?

```auto

//We loaded the XML
xmlTree = new XML();
xmlTree.ignoreWhite = true;
xmlTree.onLoad = function (success){
    if (success){
        tofillTree();
    }
    else{
        trace("The XML could not be loaded");
    }
}
xmlTree.load("animation.xml");

function tofillTree(){
    //Attach masters to the component
    attachMovie("Tree", "myTree", 1);
    
    //Properties 
    myTree.move(10, 200);
    myTree.setSize(210, 300);
    myTree.setStyle("openEasing", mx.transitions.easing.Back.easeOut);
    
    //We filled the menu 
    myTree.dataProvider = xmlTree;
    
    //event objectss
    myTree.addEventListener("change", listChanged);
}

listChanged = new Object();
listChanged.change = function(evt_obj) {
    var node = evt_obj.target.selectedNode;
    
    //If it is a folder…
    if (myTree.getIsBranch(node)){
        //If this is a branch, expand/collapse it.
        if (myTree.getIsOpen(node)){
            myTree.setIsOpen(node, false, true);
        }
        //We opened it if this closed 
        else{
            myTree.setIsOpen(node, true, true);
        }
    }
    //If it is a bond…
    else{
    holder.loadMovie(node.attributes.myURL,1);
    }
}

```

My problem is that when a new movie loaded into it using loadMovie, the attached movieClip still happened to be seen. How can we make it disappear?

Thanks a million.

Mocha
