_xmouse & _ymouse and a movieclip or somethiing

okay so lets say I have a diamond, I want it so that an object to move with the mouse but it doesnt leave the area (can’t go to where Y is).

(Object is X)

…/
…/…Y
…/…X…
…/
…/
… /

ignore dots