Constraining a draggable object

Hi there,

I’ve been trying to figure out how to constrain an object in AS3. I know I’m supposed to use a rectangle object, but I cannot figure out the syntax. Can anyone post a quick sample? I want to only allow the panel below slide up and down, and only by Y number of pixels.


function makeControlPanel() {
addChild(controlP);
controlP.controlPanel_btn.addEventListener(MouseEvent.MOUSE_DOWN,controlPanelDrag);
controlP.controlPanel_btn.addEventListener(MouseEvent.MOUSE_UP,controlPanelStopDrag);
}