# Children and go to next frame

**URL:** https://forum.kirupa.com/t/children-and-go-to-next-frame/306634
**Category:** flash
**Created:** [March 18, 2010, 6:14pm UTC](https://forum.kirupa.com/t/children-and-go-to-next-frame/306634 "2010-03-18T18:14:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![izzeygarratt](https://avatars.discourse-cdn.com/v4/letter/i/919ad9/32.png) [@izzeygarratt](https://forum.kirupa.com/u/izzeygarratt)
#### Post date: [March 18, 2010, 6:14pm UTC](https://forum.kirupa.com/t/children-and-go-to-next-frame/306634/1 "2010-03-18T18:14:36Z")

</div>

Hi I am creating a breakout game and below is a part of my code:

function updateGame(e:Event) {  
if (ball\_mc.hitTestObject(brickone\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(brickone\_mc);  
}  
if (ball\_mc.hitTestObject(bricktwo\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(bricktwo\_mc);  
}  
if (ball\_mc.hitTestObject(brickthree\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(brickthree\_mc);  
}  
if (ball\_mc.hitTestObject(brickfour\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(brickfour\_mc);  
}  
if (ball\_mc.hitTestObject(brickfive\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(brickfive\_mc);  
}  
if (ball\_mc.hitTestObject(bricksix\_mc)) {  
beepSound.play();  
xVel\*=-1;  
removeChild(bricksix\_mc);  
}  
if (ball\_mc.hitTestObject(bricksev\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(bricksev\_mc);  
}  
if (ball\_mc.hitTestObject(brickeig\_mc)) {  
beepSound.play();  
yVel\*=-1;  
removeChild(brickeig\_mc);  
}

I have got it removing the bricks as each brick has an instance name, I am now wanting to go to an end screen once all the bricks have been removed, is there a way to count the children and then put a gotoAndStop() in?
