# Mouse wheel + Movie Clip

**URL:** <https://forum.kirupa.com/t/mouse-wheel-movie-clip/234121>\
**Category:** flash\
**Created:** [July 30, 2007, 6:33pm UTC](https://forum.kirupa.com/t/mouse-wheel-movie-clip/234121 "2007-07-30T18:33:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adstudio3d](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@adstudio3d](https://forum.kirupa.com/u/adstudio3d)\
**Post date:** [July 30, 2007, 6:33pm UTC](https://forum.kirupa.com/t/mouse-wheel-movie-clip/234121/1 "2007-07-30T18:33:13Z")

</div>

I know you can use the mouse wheel to scroll through text in the flash componenet scroll pane, but is there a way to set it up to work with the code I have posted below? Any help would be greatly appreciated.  
I am starting to look into this now, just figured I’d ask here and hopefully make my search much easier.  
[AS]  
fscommand(“allowscale”, “false”);  
bar.useHandCursor = dragger.useHandCursor=false;  
space = 5;  
friction = .8;  
speed = 4;  
y = dragger.\_y;  
top = main.\_y;  
bottom = main.\_y+mask\_mc.\_height-main.\_height-space;  
dragger.onPress = function() {  
drag = true;  
this.startDrag(false, this.\_x, this.\_parent.y, this.\_x, this.\_parent.y+this.\_parent.bar.\_height-this.\_height);  
dragger.scrollEase();  
};  
dragger.onMouseUp = function() {  
this.stopDrag();  
drag = false;  
};  
////////////////////////////////////////////////////////////////////////////////////////////////  
dragger.onRollOver = function() {  
dragger.gotoAndPlay(“over”);  
};  
dragger.onRollOut = function() {  
dragger.gotoAndPlay(“off”);  
};  
up\_btn.onRollOver = function() {  
dragger.gotoAndPlay(“over”);  
};  
up\_btn.onRollOut = function() {  
dragger.gotoAndPlay(“off”);  
};  
down\_btn.onRollOver = function() {  
dragger.gotoAndPlay(“over”);  
};  
down\_btn.onRollOut = function() {  
dragger.gotoAndPlay(“off”);  
};  
////////////////////////////////////////////////////////////////////////////////////////////////  
bar.onPress = function() {  
drag = true;  
if (this.\_parent.\_ymouse\>this.\_y+this.\_height-this.\_parent.dragger.\_height) {  
this.\_parent.dragger.\_y = this.\_parent.\_ymouse;  
this.\_parent.dragger.\_y = this.\_y+this.\_height-this.\_parent.dragger.\_height;  
} else {  
this.\_parent.dragger.\_y = this.\_parent.\_ymouse;  
}  
dragger.scrollEase();  
};  
bar.onMouseUp = function() {  
drag = false;  
};  
moveDragger = function (d) {  
if ((dragger.\_y\>=y+bar.\_height-dragger.\_height && d == 3) || (dragger.\_y\<=y && d == -3)) {  
clearInterval(myInterval);  
} else {  
dragger.\_y += d;  
dragger.scrollEase();  
updateAfterEvent();  
}  
};  
up\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 9, -3);  
};  
down\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 9, 3);  
};  
up\_btn.onMouseUp = down\_btn.onMouseUp=function () {  
clearInterval(myInterval);  
};  
MovieClip.prototype.scrollEase = function() {  
this.onEnterFrame = function() {  
if (Math.abs(dy) == 0 && drag == false) {  
delete this.onEnterFrame;  
}  
r = (this.\_y-y)/(bar.\_height-this.\_height);  
dy = Math.round((((top-(top-bottom)\*r)-main.\_y)/speed)\*friction);  
main.\_y += dy;  
};  
};  
[/AS]
