# Can't remove attached mc

**URL:** https://forum.kirupa.com/t/cant-remove-attached-mc/185889
**Category:** flash
**Created:** [April 17, 2006, 1:44pm UTC](https://forum.kirupa.com/t/cant-remove-attached-mc/185889 "2006-04-17T13:44:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![paul\_ferrie](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@paul\_ferrie](https://forum.kirupa.com/u/paul_ferrie)
#### Post date: [April 17, 2006, 1:44pm UTC](https://forum.kirupa.com/t/cant-remove-attached-mc/185889/1 "2006-04-17T13:44:53Z")

</div>

Hi guys i wonder if someone can tell me where i am going wrong.  
I Have an mc in the libary, linkage is “del”  
Here is the code i use to attach to the movie

```auto

delbt.onPress = function () {
 if (typeof(_root.del) == undefined) {
  _root.attachMovie ("dele", "del", _root.getNextHighestDepth ());
  _root['del']._x = 100;
  _root['del']._y = 100;
  _root['del'].deleText.text = "Are you sure you want to delete this news story, newsID:" + newsID + "?";
  _root['del'].newsID = newsID;
 } else {
  _root['del']._x = 100;
  _root['del']._y = 100;
  _root['del'].deleText.text = "Are you sure you want to delete this news story, newsID:" + newsID + "?";
  _root['del'].newsID = newsID;
 }
};

```

This works fine to a point.  
in the “del” mc i have a button to remove “del” mc if no longer required.

```auto

on (release) {
 unloadMovie(_root.del)
}

```

I discovered that this only remove the content and not the mc that holds it “del”  
So i tried

```auto

on (release) {
 _root.del.removeMovieClip ();
}

```

But this does nothing.  
Anyone.  
thanks  
Paul

---

<div class="post-metadata">

### Author: ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)
#### Post date: [April 17, 2006, 1:51pm UTC](https://forum.kirupa.com/t/cant-remove-attached-mc/185889/2 "2006-04-17T13:51:46Z")

</div>

It’s most likely a depth issue, if the MC is on too high of a depth, you cannot remove it for some reason. Try this:

```auto
delbt.onPress = function () {
 if (typeof(_root.del) == undefined) {
  _root.attachMovie ("dele", "del", 100);
  _root['del']._x = 100;
  _root['del']._y = 100;
  _root['del'].deleText.text = "Are you sure you want to delete this news story, newsID:" + newsID + "?";
  _root['del'].newsID = newsID;
 } else {
  _root['del']._x = 100;
  _root['del']._y = 100;
  _root['del'].deleText.text = "Are you sure you want to delete this news story, newsID:" + newsID + "?";
  _root['del'].newsID = newsID;
 }
};

```

---

<div class="post-metadata">

### Author: ![Mirandir](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mirandir](https://forum.kirupa.com/u/Mirandir)
#### Post date: [April 17, 2006, 2:01pm UTC](https://forum.kirupa.com/t/cant-remove-attached-mc/185889/3 "2006-04-17T14:01:14Z")

</div>

Is there any instance of “del” put to stage at author time? Does it ever swap depths?

The only problem I can see is that:

```auto
if(typeof(_root.del) == undefined)

```

should be:

```auto
(typeof(_root.del) == "undefined")

```

/Mirandir
