Flash as2 Please, check my code can't find the error

Well, the code works “almost” flawlessly. Problem is, the “Hero” keeps falling through the Ground movieclip. What am I missing? Here is the code:

onClipEvent(load)
{
    speed = 5;
    gravity = 0;
    r = _height/2;
    jumping = false;
    jumpHeight = 10;
}

onClipEvent(enterFrame)
{    
    if(Key.isDown(Key.UP) && !jumping)
    {
        gravity = -jumpHeight;
        jumping = true;
    }
    if(!_root.Ground.hitTest(_x, _y, true))
    {
        gravity ++;
        _y += gravity;
    }
    else
    {
        jumping = false;
        gravity = 0;
    }
    while(_root.Ground.hitTest(_x, _y-1+r, true))
    {
        jumping = false;
        _y --;
    }
    if(Key.isDown(Key.RIGHT))
    {
        _x += speed;
        gotoAndStop(3);
    }
    else if(Key.isDown(Key.LEFT))
    {
        _x -= speed
        gotoAndStop(2)
    }
    else
    {
        gotoAndStop(1);
    }
}