# Garbage Collection for Custom Effects!

**URL:** <https://forum.kirupa.com/t/garbage-collection-for-custom-effects/325504>\
**Category:** flash\
**Created:** [October 19, 2011, 2:54pm UTC](https://forum.kirupa.com/t/garbage-collection-for-custom-effects/325504 "2011-10-19T14:54:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thovas](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Thovas](https://forum.kirupa.com/u/Thovas)\
**Post date:** [October 19, 2011, 2:54pm UTC](https://forum.kirupa.com/t/garbage-collection-for-custom-effects/325504/1 "2011-10-19T14:54:42Z")

</div>

I decide to make some custom effects for movie clips of my own, but while doing it i found out that i don`t know what happens withe the effect object after his job is done.

```auto
package {
    import flash.events.*;
    import flash.display.*;
    public class effTest extends MovieClip{
        private var _effTarget:MovieClip;
        public function effTest( target:MovieClip) {
            _effTarget = target;
            _effTarget.alpha = 0;
            addEventListener(Event.ENTER_FRAME, doEff);
        }
        private function doEff(event:Event):void{
            _effTarget.alpha += 0.01;
            
            if(_effTarget.alpha == 1){
                removeEventListener(Event.ENTER_FRAME, doEff);
                
            }
        }

    }
    
}

```

This is very simple example of what i am doing in general. It is used also very simple

```auto
var customEff:effTest = new effTest(mc);

```

So the thing i am looking for is way to clean up after the effects is complete. And it will be great if the effects is able to do it on its own.

Thanks in advance  
Regards Thovas
