Using a deconstructor

Hi! First post. :slight_smile:

Well, I know that in C++ you can use a deconstructor, but I tried googling around for one, but couldn’t find anything.

The reason I need it is, lets say I have a class.


class baby
{
      function baby(name)
      {
           attachMovie(blablblalb, name, blalala);
      }
}

Ok, then I make an object out of the class:


baby1 = new baby("kirupa");

Now Kirupa engages in a battle, and dies. :frowning:
So, I deleted Kirupa:


delete baby1;

The problem here is that when I deleted him, logically, the movieclip I attached to the scene gets removed. That’s why I need a deconstructor, so when the object is deleted, the movieclip should be removed. I rather not use a workaround, unless their is no other option. :frowning:

Please tell me there is a deconstructor! :thumb2: