Keeping a MovieClip within a set area?

I am having problems with a MovieClip, basically it can be moved arround with the mouse and it is resizeable but when i move it arround or enlarge the movieclip (when its in a published format) i want to constrain it to an area such as 400 width by 400 height.

Because at the moment you can drag or resize the movieclip ouside the whole frame, which i dont want. i want to constrain it to a set area.

is there a code in which i can make this possible.

thanks in advance

safa