Hi everyone,
I'm having a little trouble constrianing a little mc.
I have it working but it dont work all that well.

Heres my code:

onClipEvent (enterFrame) {
startDrag(this, true);
rightedge=325 ;
if(_x+_width/2>rightedge) {
_x=rightedge-_width/2;
}
leftedge=120;
if(_x+width/2<leftedge) {
_x=leftedge-_width/2;
}
topedge=52;
if(_y+height/2<topedge) {
_y=topedge-_height/2;
}
bottomedge=310;
if(_y+height/2>bottomedge) {
_y=bottomedge-_height/2;
}
}


It is all good other than it either sits at the top or the bottom.

Go on, have a crack ..