# Completely remove a class instance? (EventListeners etc..)

**URL:** <https://forum.kirupa.com/t/completely-remove-a-class-instance-eventlisteners-etc/329064>\
**Category:** flash\
**Created:** [July 17, 2012, 2:34pm UTC](https://forum.kirupa.com/t/completely-remove-a-class-instance-eventlisteners-etc/329064 "2012-07-17T14:34:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tompa](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@Tompa](https://forum.kirupa.com/u/Tompa)\
**Post date:** [July 17, 2012, 2:34pm UTC](https://forum.kirupa.com/t/completely-remove-a-class-instance-eventlisteners-etc/329064/1 "2012-07-17T14:34:09Z")

</div>

Hello there!  
I’ve struggled another problem, this time it’s about a class instance that keeps working\*(EventListeners still going)\* even when I’ve used removeChild and null’d the instance.

Here are my classes I use:

```auto
private var frame_splash:Splash;
private var frame_gameStart:GameStart;
private var frame_gameOver:GameOver;
private var frame_levelSelect:LevelSelect;

```

This is how I display them _(Just showing the splash\_screen)_:

```auto
public function show_splash():void {
    removeInstances();
    frame_splash = new Splash(this);
    addChild(frame_splash);
}

```

And the function removeInstances():

```auto
private function removeInstances():void {
    if (frame_splash) { 
        removeChild(frame_splash); 
        frame_splash = null;
    }
    if (frame_gameStart) {
        removeChild(frame_gameStart);
        frame_gameStart = null;
    }
    if (frame_gameOver) {
        removeChild(frame_gameOver);
        frame_gameOver = null;
    }
    if (frame_levelSelect) {
        removeChild(frame_levelSelect);
        frame_levelSelect = null;
    }
}

```

As far as I understand, removeChild will only remove the child on the stage _(the visible stuff)_, and the by setting the instance to null, will only remove the access from the instance, becuase when I look at the output I can see the game still tracing stuff about the game \*(that’s not being displayed becuase of removeChild)  
\*  
What would be the best way to remove/stop/hide the EventListeners, visible childs etc.?

_Thanks in advance,  
Tompa_
