# How will i adjust scrolling speed in this class?

**URL:** <https://forum.kirupa.com/t/how-will-i-adjust-scrolling-speed-in-this-class/237430>\
**Category:** Uncategorized\
**Created:** [August 30, 2007, 9:37am UTC](https://forum.kirupa.com/t/how-will-i-adjust-scrolling-speed-in-this-class/237430 "2007-08-30T09:37:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nico](https://forum.kirupa.com/u/nico)\
**Post date:** [August 30, 2007, 9:37am UTC](https://forum.kirupa.com/t/how-will-i-adjust-scrolling-speed-in-this-class/237430/1 "2007-08-30T09:37:44Z")

</div>

import flash.geom.Rectangle;  
class MyScrollbar  
{  
public var content:MovieClip;  
public var viewable:Rectangle;  
public var dragger:MovieClip;  
public var track:MovieClip;  
public var left:Number;  
public var top:Number;  
public var right:Number;  
public var bottom:Number;  
public var move\_speed:Number = 0;  
public var scrollable:Number = 0;  
public var top\_scroll:Number = 0;  
public function MyScrollbar ()  
{  
left = track.\_x;  
top = track.\_y;  
right = track.\_x;  
bottom = track.\_y + (track.\_height - dragger.\_height);  
Mouse.addListener (this);  
}  
public function setContent (content:MovieClip):Void  
{  
this.content = content;  
setScrollProps ();  
}  
public function setViewable (viewable:Rectangle):Void  
{  
this.viewable = viewable;  
setScrollProps ();  
}  
public function setEasing (value:Boolean, speed:Number):Void  
{  
content.isEasing = value;  
if (speed \> 0 && value)  
{  
content.speed = speed;  
}  
}  
public function updateContentPos ():Void  
{  
var percent\_scrolled:Number = (dragger.\_y - track.\_y) / (track.\_height - dragger.\_height);  
content.newY = Math.round (top\_scroll - (percent\_scrolled \* scrollable));  
}  
public function setScrollProps ():Void  
{  
trace(“Hello”);  
if (viewable == undefined || content == undefined)  
{  
return;  
}  
scrollable = content.\_height - viewable.height;  
top\_scroll = content.\_y;  
initElements ();  
checkScrollability ();  
}  
public function checkScrollability ():Void  
{  
if (scrollable \< 0)  
{  
dragger.\_visible = false;  
track.\_alpha = 0;  
}  
else  
{  
dragger.\_visible = true;  
}  
}  
public function onMouseWheel (delta:Number):Void  
{  
var speed:Number = (delta \> 0) ? move\_speed : -move\_speed;  
dragger.\_y = Math.min (bottom, Math.max (top, dragger.\_y - speed));  
updateContentPos ();  
}  
public function initElements ():Void  
{  
var src;  
dragger.src = this;  
track.src = this;  
var newY;  
var isEasing;  
var speed;  
content.speed = move\_speed;  
content.onEnterFrame = function ()  
{  
if (this.isEasing)  
{  
this.\_y += (this.newY - this.\_y) \>\> this.speed;  
return;  
}  
this.\_y = this.newY;  
};  
dragger.onPress = function ()  
{  
this.startDrag (false, this.src.left, this.src.top, this.src.right, this.src.bottom);  
this.onMouseMove = function ()  
{  
this.src.updateContentPos ();  
};  
};  
dragger.onMouseUp = function ()  
{  
stopDrag ();  
delete this.onMouseMove;  
};  
}  
}

i just copied this code from the source and experiments, just want to ask for help on how can i change this so that the scrolling of the contents is much faster… also how can i change and remove the rectangle object and use the mask for scrolling in my movie:) thanks:)
