Going to a new frame

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;

}