# Problem with No. of Children

**URL:** <https://forum.kirupa.com/t/problem-with-no-of-children/320069>\
**Category:** flash\
**Created:** [March 13, 2011, 11:33am UTC](https://forum.kirupa.com/t/problem-with-no-of-children/320069 "2011-03-13T11:33:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CCG1993](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@CCG1993](https://forum.kirupa.com/u/CCG1993)\
**Post date:** [March 13, 2011, 11:33am UTC](https://forum.kirupa.com/t/problem-with-no-of-children/320069/1 "2011-03-13T11:33:43Z")

</div>

I am tryin to create an asteroids game:

When I fire the bullet everything is fine but when the second bullet is fired the first one stops and the second one is fine…etc.

Seemingly it is removing the properties from the first and placing them on the other when another child is added.

Here’s my code:

```auto
function keyDownHandler(event:KeyboardEvent):void{
 
 if (event.keyCode == 32){

  newBullet = new bullet()
  addChild(newBullet)
  trace(newBullet.numChildren)

  for(var a:int = 0; a < newBullet.numChildren;a++){
  newBullet.x = spaceship.x
  newBullet.y = spaceship.y
  newBullet.rotation = spaceship.rotation
  newBullet.addEventListener(Event.ENTER_FRAME, bulletCode);
 
 }
 }
}
function bulletCode(event:Event):void{
 
  xBulletVel = Math.sin(radAngle)
  yBulletVel = Math.cos(radAngle) 
 
  newBullet.x += xBulletVel
  newBullet.y += (yBulletVel)*-1
 
}

```

thanks 🙂
