# AS2: Unload movieclip problem

**URL:** <https://forum.kirupa.com/t/as2-unload-movieclip-problem/303009>\
**Category:** flash\
**Created:** [January 12, 2010, 11:49am UTC](https://forum.kirupa.com/t/as2-unload-movieclip-problem/303009 "2010-01-12T11:49:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![callmejay](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@callmejay](https://forum.kirupa.com/u/callmejay)\
**Post date:** [January 12, 2010, 11:49am UTC](https://forum.kirupa.com/t/as2-unload-movieclip-problem/303009/1 "2010-01-12T11:49:37Z")

</div>

Hi guys,

Work bought this menu and asked me to edit it even though i’m no AS2 expert just so basic knowledge, I’ve come pretty far so far but now i ran into a problem (probably the final one)…

If anyone could help me i would greately appreciate it, the problem:

The menu uses XML to load in the menu, so all the options are dynamical.  
If you click a button it loads a menu into the stage, but if i click an other it overlapse the old one…

So i figured i need to unload all the other movies on the stage, how do I do this?

This is what I got for onRelease functions:

```auto
//Release function..
        _parent.AccordionMenu["Menu"+a].onRelease = function() {
            if(type[this.getDepth()] == "gotoAndStop"){
                _parent[frameTarget[this.getDepth()]].gotoAndStop(frame[this.getDepth()]);
                _parent.InfoMC.submenuSelectiontxt.text = "menu title <"+title[this.getDepth()]+">";
                _parent.InfoMC.submenuItemtxt.text = "menu item type <"+type[this.getDepth()]+">";
                _parent.InfoMC.destinationtxt.text = "menu item destination <frame/label "+frame[this.getDepth()]+">";
                _parent.InfoMC.targettxt.text = "menu item target object <"+frameTarget[this.getDepth()]+">";
            }
            else{
                if(type[this.getDepth()] == "getURL"){
                    getURL(url[this.getDepth()], urlTarget[this.getDepth()]);
                    _parent.InfoMC.submenuSelectiontxt.text = "menu title <"+title[this.getDepth()]+">";
                    _parent.InfoMC.submenuItemtxt.text = "menu item type <"+type[this.getDepth()]+">";                    
                    _parent.InfoMC.destinationtxt.text = "menu item destination <"+url[this.getDepth()]+">";                
                    _parent.InfoMC.targettxt.text = "menu item target <"+urlTarget[this.getDepth()]+">";
                }
                else{
                    _parent.InfoMC.submenuSelectiontxt.text = "menu title <"+title[this.getDepth()]+">";
                    _parent.InfoMC.submenuItemtxt.text = "invalid command from xml-file <"+type[this.getDepth()]+"> check your code";
                    _parent.InfoMC.destinationtxt.text = "<none>";
                    _parent.InfoMC.targettxt.text = "<none>";
                }
            }
        }
        _parent.AccordionMenu["Menu"+a].onRollOver = function() {
            _parent.InfoMC.Selectiontxt.text = "title <"+title[this.getDepth()]+">";

```

for submenu’s:

```auto
//onRelease function for sub menus..
                if(this._ymouse >= (number(titleHeight[this.getDepth()])+subItemDistance)+(b*(number(titleHeight[this.getDepth()])+subItemDistance)) && this._ymouse < (number(titleHeight[this.getDepth()])+subItemDistance)+((b+1)*(number(titleHeight[this.getDepth()])+subItemDistance))){
                    if(subType[this.subMenus["subMenu"+b].getDepth()] == "gotoAndStop"){
                        _parent[subFrameTarget[this.subMenus["subMenu"+b].getDepth()]].gotoAndStop(frame[this.subMenus["subMenu"+b].getDepth()]);
                        _parent.InfoMC.submenuSelectiontxt.text = "sub menu title <"+subTitle[this.subMenus["subMenu"+b].getDepth()]+">";
                        _parent.InfoMC.submenuItemtxt.text = "sub menu item type <"+subType[this.subMenus["subMenu"+b].getDepth()]+">";
                        _parent.InfoMC.destinationtxt.text = "sub menu item destination <frame/label "+frame[this.subMenus["subMenu"+b].getDepth()]+">";
                        _parent.InfoMC.targettxt.text = "sub menu item target object <"+subFrameTarget[this.subMenus["subMenu"+b].getDepth()]+">";
                    }
                    else{
                        if(subType[this.subMenus["subMenu"+b].getDepth()] == "getURL"){
                            getURL(url[this.subMenus["subMenu"+b].getDepth()], subUrlTarget[this["subMenu"+b].getDepth()]);
                            _parent.InfoMC.submenuSelectiontxt.text = "sub menu title <"+subTitle[this.subMenus["subMenu"+b].getDepth()]+">";
                            _parent.InfoMC.submenuItemtxt.text = "sub menu item type <"+subType[this.subMenus["subMenu"+b].getDepth()]+">";
                            _parent.InfoMC.destinationtxt.text = "sub menu item destination <"+url[this.subMenus["subMenu"+b].getDepth()]+">";
                            _parent.InfoMC.targettxt.text = "sub menu item target <"+subUrlTarget[this.subMenus["subMenu"+b].getDepth()]+">";
                        }
                        else{
                            _parent.InfoMC.submenuSelectiontxt.text = "sub menu title <"+subTitle[this.subMenus["subMenu"+b].getDepth()]+">";
                            _parent.InfoMC.submenuItemtxt.text = "invalid command from xml-file <"+subType[this.subMenus["subMenu"+b].getDepth()]+"> check your code";
                            _parent.InfoMC.destinationtxt.text = "<none>";
                            _parent.InfoMC.targettxt.text = "<none>";
                        }
                    }
                }
            }    

```

If anyone could help me, it would be grately appreciated!!

Jay
