# Delete instance of class from class' method

**URL:** <https://forum.kirupa.com/t/delete-instance-of-class-from-class-method/173638>\
**Category:** Uncategorized\
**Created:** [December 28, 2005, 5:12am UTC](https://forum.kirupa.com/t/delete-instance-of-class-from-class-method/173638 "2005-12-28T05:12:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)\
**Post date:** [December 28, 2005, 5:12am UTC](https://forum.kirupa.com/t/delete-instance-of-class-from-class-method/173638/1 "2005-12-28T05:12:52Z")

</div>

So I have a class called Unit. When I use this class in a .fla file, I create it by saying:

var unit00:Unit = new Unit(…);

So then it creates a gfx representation of the screen for me. I would like to have a method like this:

```php

public function remove ():Void {
   unit_mc.removeMovieClip();
   //deleting the gfx representation of the class in the .fla
   delete instance of this;
   //I want to delete the variable that references the instance of this class
}

```

So how do I get this to work? I know that delete this will not work when defined inside the class. How do I target the .fla’s instance name when I don’t know what it will be called?

Thanks for any assistance
