# Clean up problem

**URL:** <https://forum.kirupa.com/t/clean-up-problem/310647>\
**Category:** Uncategorized\
**Created:** [June 15, 2010, 7:22pm UTC](https://forum.kirupa.com/t/clean-up-problem/310647 "2010-06-15T19:22:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackout188](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blackout188](https://forum.kirupa.com/u/blackout188)\
**Post date:** [June 15, 2010, 7:22pm UTC](https://forum.kirupa.com/t/clean-up-problem/310647/1 "2010-06-15T19:22:18Z")

</div>

for (i=2;i\<9;i++){  
var com:c1 = new c1();  
com.x = (i-1)\*90;  
com.y = 280;  
com.name = “ac”+i;  
trace(com.name)  
trace(com.x);  
addChild(com);  
}  
this is what I used to generate my objects

addEventListener(MouseEvent.CLICK, clickHandler);  
this is my listener for mouseevent

function cleanup(){  
for (i=1; i\<8; i++) {  
removeChild(this[“com”+i])  
removeEventListener(MouseEvent.CLICK, clickHandler)  
}  
}

and this is my clean up, apprentely I can’t delete my objects and listener because they don’t exist, they are null. Has anyone run into similar problem before? All helps appreciated
