# removeChild / custom class help

**URL:** <https://forum.kirupa.com/t/removechild-custom-class-help/252148>\
**Category:** flash\
**Created:** [February 16, 2008, 7:30pm UTC](https://forum.kirupa.com/t/removechild-custom-class-help/252148 "2008-02-16T19:30:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laubsterboy](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@laubsterboy](https://forum.kirupa.com/u/laubsterboy)\
**Post date:** [February 16, 2008, 7:30pm UTC](https://forum.kirupa.com/t/removechild-custom-class-help/252148/1 "2008-02-16T19:30:39Z")

</div>

First let me say that I am really new to OOP/AS3, so if there is something I’m trying to do that is completely wrong, please let me know. Also, I am not looking for anyone to type code for me (unless necessary to illustrate a point), this is more of a ‘common practice’/‘the correct way to do it’ kind of question.

What I am trying to do is use a Main class to create laser instances using the Lasers class. Inside the Main class I have a laserContainer Sprite that the laser instances are added to, using laserContainer.addChild(new Laser()), on the MOUSE\_DOWN event.

I know I could easily use laserContainer.removeChildAt(depthOfLaserToRemove) from within the Main class to remove the laser once it is no longer needed. The problem I am having is that inside the Laser class it has an ENTER\_FRAME Event that controls the lasers movement, as well as, ricochets the laser if it collides with something at the correct angle; after the laser has been told to ricochet it needs to be removed a short time later.

Essentially, I need to be able to remove the laser instance from within the Main class as well as in the Laser class, preferably using a public function within the Laser class called “remove”.

Is this the correct way to dynamically create Laser instances or am I way off base here? Do I need some sort of LaserController class?
