# Scrollbar tutorial

**URL:** <https://forum.kirupa.com/t/scrollbar-tutorial/184320>\
**Category:** Uncategorized\
**Created:** [April 4, 2006, 9:26am UTC](https://forum.kirupa.com/t/scrollbar-tutorial/184320 "2006-04-04T09:26:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MyDNA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MyDNA](https://forum.kirupa.com/u/MyDNA)\
**Post date:** [April 4, 2006, 9:26am UTC](https://forum.kirupa.com/t/scrollbar-tutorial/184320/1 "2006-04-04T09:26:44Z")

</div>

Hello

i used the files from the scrollbar tutorial and added and changed some code to add easing (that code i found somewhere on this forum) That works fine.  
But now…

I found a file on [ffiles.com](http://ffiles.com) wich loads news dynamicly from a xml file.

i added it. And it works fine till you start scrolling. It never reaches the bottom of the news.

Can someone help me out with it?  
My file is ready to download from here… [http://www.dri360.com/dynamic\_news.zip](http://www.dri360.com/dynamic_news.zip)

the code where i’m talking about is on frame13 of nieuws.fla

muchos gracias :azn:  
Thanks :p:

---

<div class="post-metadata">

**Author:** ![MyDNA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MyDNA](https://forum.kirupa.com/u/MyDNA)\
**Post date:** [April 4, 2006, 8:13pm UTC](https://forum.kirupa.com/t/scrollbar-tutorial/184320/2 "2006-04-04T20:13:05Z")

</div>

This is the AS code from frame 13:

```auto

scrolling = function (easing)
{
	var moveSpeed:Number = 20;
	var easingSpeed:Number = 10;
	var scrollHeight:Number = scrollTrack._height;
	var contentHeight:Number = contentMain._height;
	var scrollFaceHeight:Number = scrollFace._height;
	var maskHeight:Number = maskedView._height;
	var initPosition:Number = scrollFace._y = scrollTrack._y;
	var initContentPos:Number = contentMain._y;
	var finalContentPos:Number = maskHeight - contentHeight + initContentPos;
	var left:Number = scrollTrack._x;
	var top:Number = scrollTrack._y;
	var right:Number = scrollTrack._x;
	var bottom:Number = scrollTrack._height - scrollFaceHeight + scrollTrack._y;
	var dy:Number = 0;
	var speed:Number = 20;
	var moveVal:Number = (contentHeight + maskHeight) / (scrollHeight - scrollFaceHeight);
	scrollFace.onPress = function ()
	{
		var currPos:Number = this._y;
		startDrag (this, false, left, top, right, bottom);
		this.onMouseMove = function ()
		{
			dy = Math.abs (initPosition - this._y);
			contentMain.newY = Math.round (dy * -1 * moveVal + initContentPos);
		};
	};
	contentMain.onEnterFrame = function ()
	{
		if (!easing || easing == undefined)
		{
			this._y = this.newY;
		}
		else
		{
			this._y += (this.newY - this._y) / easingSpeed;
		}
	};
	scrollFace.onMouseUp = function ()
	{
		stopDrag ();
		delete this.onMouseMove;
	};
	if (contentHeight < maskHeight)
	{
		scrollFace._visible = true;
	}
	else
	{
		scrollFace._visible = false;
	}
};
scrolling (true);

```
