Getting the distance between two movieclips' x value

Hello,

At first it seemed simple to find out the distance between two movieclips’ x values, I could have just done:

mc1.x - mc2.x

However, What I’m trying to achieve is a movieclip of a person climbing an un-even surfaced wall, and to do this I first want to make sure the x value of the person is always equal to the edge of the wall.

How would I calculate the exact position of wall’s edge where the person is touching it? I’ve attached an image to show what I mean.

Thanks.