# Help with dynamic scrollers

**URL:** <https://forum.kirupa.com/t/help-with-dynamic-scrollers/185558>\
**Category:** flash\
**Created:** [April 14, 2006, 6:29am UTC](https://forum.kirupa.com/t/help-with-dynamic-scrollers/185558 "2006-04-14T06:29:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattzi](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mattzi](https://forum.kirupa.com/u/mattzi)\
**Post date:** [April 14, 2006, 6:29am UTC](https://forum.kirupa.com/t/help-with-dynamic-scrollers/185558/1 "2006-04-14T06:29:21Z")

</div>

hi there, i have got the following code, which i have found on this forum somewhere, now it does almost exactically what i need it to do.

What i need the code to do is get the size of the dynamic textfield and scroll it, the code finds a number and scrolls it but it doesnt scroll the hole box. The text is loaded in from a .txt file. here is the code

```auto

//loading in the text
myData = new LoadVars()
myData.load("text.txt")
myData.onLoad = function(succes){
    _root.main.textarea.multiline = true;
    _root.main.textarea.wordWrap = true;
    _root.main.textarea.autoSize = "left";
    _root.main.textarea = this.scrolltext;
}
    

//the scroller
var space = 20;
var friction = 0.9;
var speed = 10;
var y = dragger._y;
var top = main._y;
var 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;
    };
};

```

thank you for your help
