# Scroll/Mouse Wheel

**URL:** <https://forum.kirupa.com/t/scroll-mouse-wheel/284797>\
**Category:** flash\
**Created:** [March 23, 2009, 7:01pm UTC](https://forum.kirupa.com/t/scroll-mouse-wheel/284797 "2009-03-23T19:01:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rusbugus](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@rusbugus](https://forum.kirupa.com/u/rusbugus)\
**Post date:** [March 23, 2009, 7:01pm UTC](https://forum.kirupa.com/t/scroll-mouse-wheel/284797/1 "2009-03-23T19:01:05Z")

</div>

I am having a difficult time getting the scroll/mouse wheel to work on my actionscript code. If someone could show me what I should do to get the code working that would be very great. This is the code I used:

var yOffset1:Number;  
var yMin1:Number = 0;  
var yMax1:Number = scrollbar.bar.height - scrollbar.thumb.height;  
scrollbar.thumb.addEventListener(MouseEvent.MOUSE\_DOWN, thumbDown1);  
stage.addEventListener(MouseEvent.MOUSE\_UP, thumbUp1);

function thumbDown1(evt:MouseEvent):void {  
stage.addEventListener(MouseEvent.MOUSE\_MOVE, thumbMove1);  
yOffset1 = mouseY - scrollbar.thumb.y;  
}  
function thumbUp1(evt:MouseEvent):void {  
stage.removeEventListener(MouseEvent.MOUSE\_MOVE, thumbMove1);  
}  
function thumbMove1(evt:MouseEvent):void {  
scrollbar.thumb.y = mouseY - yOffset1;  
if (scrollbar.thumb.y \<= yMin1)  
scrollbar.thumb.y = yMin1;  
if (scrollbar.thumb.y \>= yMax1)  
scrollbar.thumb.y = yMax1;  
var sp:Number = scrollbar.thumb.y / yMax1;  
Tweener.addTween(content, {y:(-sp\*(txtbtn1.height-maskee.height)), time:1});  
evt.updateAfterEvent();  
}  
}
