# Scrolling a movieclip

**URL:** <https://forum.kirupa.com/t/scrolling-a-movieclip/161850>\
**Category:** Uncategorized\
**Created:** [September 7, 2005, 3:58pm UTC](https://forum.kirupa.com/t/scrolling-a-movieclip/161850 "2005-09-07T15:58:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![5teve](https://avatars.discourse-cdn.com/v4/letter/5/df705f/32.png) [@5teve](https://forum.kirupa.com/u/5teve)\
**Post date:** [September 7, 2005, 3:58pm UTC](https://forum.kirupa.com/t/scrolling-a-movieclip/161850/1 "2005-09-07T15:58:42Z")

</div>

Hi all.  
Bit stuck at the moment.  
I have a site that is all but finished but while adding the copy the client asked for scroll bars.

I had a script which I used in a previous site which worked fine, so thought i would re-use it. The only problem is when I try to use a different font the scolling text becomes much larger than it should be, and I just cannot find what could be causing this.

I have pasted the code below in the hope there is a clue I have missed.  
Alternatively, does anybody have a better idea for scrolling a movieclip?.  
I need to have my own custom scrollbars and no borders so the ScrollPane component is out.

Any advice would be welcome.

Thanks

Steve

[AS]

fscommand(“allowscale”, “false”);  
bar.useHandCursor = dragger.useHandCursor=false;  
space = 20;  
friction = 0.9;  
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.\_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;  
};  
};  
[/AS]
