Keep my dragable MC from going out of frame

I’m currently working on a flash puzzle game and I was wondering if anyone knew of an easy way to keep my puzzle pieces from being able to be drug out of frame?