Flash zoom / pan limiting mc movement to stage borders

Hello!

What I’m trying to do is kind a zooming / pan feature on my movieClip that is larger than the Stage, actually might be, if not the it wont move at all. Anyway, Becouse I would like to set stage size to dynamic. I need to limit dynamically the movieClip’s movement. Moving is based on mouse movement.
Questions is how to set these (pan?) borders / limitations?
I’ve attached an image if that helps you to figure my problem:

The stage is the gry one. Blue and green and red rectangulars are the movieclip that I’m trying to move, arror is the direction (of course other directions as well are allowed). Blue is starting point, green position is allowed, where the red rectanlular is should be limited area, and movement should have stopped before it got so far.
Can someone give me advise how to set these borders?