# Going to a new frame

**URL:** <https://forum.kirupa.com/t/going-to-a-new-frame/316841>\
**Category:** Uncategorized\
**Created:** [December 3, 2010, 7:12pm UTC](https://forum.kirupa.com/t/going-to-a-new-frame/316841 "2010-12-03T19:12:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ncking](https://avatars.discourse-cdn.com/v4/letter/n/df705f/32.png) [@ncking](https://forum.kirupa.com/u/ncking)\
**Post date:** [December 3, 2010, 7:12pm UTC](https://forum.kirupa.com/t/going-to-a-new-frame/316841/1 "2010-12-03T19:12:14Z")

</div>

Hello im new to flash and I was looking for some help. I have a game like “Brick Breaker” where you have a rectangle that hits a ball into some blocks, and they get removed. What I would like to do is that when all the blocks have been removed, then it should move onto frame 2. I have added the blocks to the canvas by using actionscript.

\_root.createEmptyMovieClip(“blocks”, 1);  
blockCount=0;

createBlock = function(x,y)  
{

```
blocks.attachMovie( "block" , blockCount, blockCount);

blocks[blockCount]._x=x;
blocks[blockCount]._y=y;
    

blocks[blockCount].onEnterFrame = function()
{
    if (this.hitTest( ball))
    {
        this.removeMovieClip();
        ball.dy=ball.dy*(-1);
        scorecount++
        score.text=scorecount;
        blockCount--;
        
        if( blockCount == 0)
        {
            gotoAndStop(2);
        }
        
    }
    
}
 blockCount++;
 blockCount%=1;

```

}
