1) Limiting mask drag to Y axis:
Just use the startDrag's second argument (bounds:Rectangle).
// startDrag method details
startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
give it a Rectangle that it should use as its bounds. Details and examples can be found on Adobe's livedocs. For example, to lock dragging to only the Y axis, you should make the width of your Rectangle equal to 0.
var dragBounds:Rectangle = new Rectangle(startX, startY, 0, dragHeight);
myMask.startDrag(false, dragBounds);
2) Return mask to original Y, on drop:
The easiest way is to listen to the mouseup event on the stage. when this fires and you are dragging the mask, then set the mask y to its original location. Personally I would use Tweener to send the mask back, but you can do it how you like (possibly on enterFrame).
public function Main()
{
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
private function mouseUpHandler(e:MouseEvent):void
{
if (draggingMask)
{
Tweener.addTween(myMask, { y:originalY, time:0.5, transition:"easeOutQuad" });
draggingMask = false;
}
}
You will need to set draggingMask to true when you start dragging the mask, and to false when you release it. You will also need a variable to store the original location (I used "originalY" in my example above).