im not sure this is the BEST method for calculating the rotation needed, but it's one I came up with
size = _width/2; //half of player's width. I'm assuming you centered your character movieclip, at least x-wise
p1 = 0;
while(!_root.g.hitTest(_x-size,p1,true)) //g is your ground MC. this checks for the first hit of the ground starting from the top
p1++;
p2=0;
while(!_root.g.hitTest(_x+size,p2,true))
p2++;
_rotation = 180-Math.atan2(size*2,p2-p1)*180/Math.PI ;