# PLEASE HELP! Easing scrollbar code needed to add mouse wheel function not working?

**URL:** <https://forum.kirupa.com/t/please-help-easing-scrollbar-code-needed-to-add-mouse-wheel-function-not-working/227116>\
**Category:** flash\
**Created:** [May 27, 2007, 6:33am UTC](https://forum.kirupa.com/t/please-help-easing-scrollbar-code-needed-to-add-mouse-wheel-function-not-working/227116 "2007-05-27T06:33:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ace0002](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@ace0002](https://forum.kirupa.com/u/ace0002)\
**Post date:** [May 27, 2007, 6:33am UTC](https://forum.kirupa.com/t/please-help-easing-scrollbar-code-needed-to-add-mouse-wheel-function-not-working/227116/1 "2007-05-27T06:33:19Z")

</div>

[COLOR=black][FONT=Arial]Hi,[/FONT][/COLOR]

[COLOR=black][FONT=Arial]I really appreciate some help here is the code below for my scrollbar which works fine but I can’t get the mouse wheel code to work (I’ve taken it out since) How to add a mouselistener and get it to work with my scrollbar? Apparently some simple code but when I put it in nothing works please help if you could add the code in my code that might work. [/FONT][/COLOR]

I think I need to add some code that listens to the mouse wheel? PLEASE HELP! I only know VERY basic action script.

HERE is the code:

//Scrollbar Control//

fscommand(“allowscale”, “false”);  
bar.useHandCursor = dragger.useHandCursor=false;  
space = 0;  
friction = 0.3;  
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;  
};  
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 == 1) || (dragger.\_y\<=y && d == -1)) {  
clearInterval(myInterval);  
} else {  
dragger.\_y += d;  
dragger.scrollEase();  
updateAfterEvent();  
}  
};  
up\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 18, -1);  
};  
down\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 18, 1);  
};  
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;  
};  
};
