So, for the life of me, I can't figure out why my script isn't behaving the way I'd like it to.

I'm trying to have content (buttons and images) within a movie be vertically scrollable based on the position of the user's cursor, but the movie just keeps scrolling right off the page! I'm not sure what I've done wrong and/or overlooked, since I would like the movie to stop when it's reached the very top and the very bottom. I hope someone can shed some light on this. Thanks!!


onClipEvent (load) {
scrollMovie = this._height - Stage.height;
topScrollMargin = 100;
bottomScrollMargin = 600;
horizontalScrollMargin = 0;
acceleration = 10;
}

onClipEvent (enterFrame) {
if (_root._ymouse >= 0 &&
_root._ymouse <= topScrollMargin &&
_root._xmouse >= horizontalScrollMargin &&
_root.scroll._y <= 0){

this._y -= (_root._ymouse - topScrollMargin) / acceleration;
}

else if (_root._ymouse >= bottomScrollMargin &&
_root._ymouse <= Stage.height &&
_root._xmouse >= horizontalScrollMargin &&
_root.scroll._y >= -scrollMovie) {

this._y -= (_root._ymouse - bottomScrollMargin) / acceleration;
}
}