Can't remove attached mc

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


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.


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

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


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

But this does nothing.
Anyone.
thanks
Paul

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:

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;
 }
};

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:

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

should be:

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

/Mirandir