# All actionscript scrollbar issue

**URL:** <https://forum.kirupa.com/t/all-actionscript-scrollbar-issue/180308>\
**Category:** Uncategorized\
**Created:** [February 27, 2006, 6:42pm UTC](https://forum.kirupa.com/t/all-actionscript-scrollbar-issue/180308 "2006-02-27T18:42:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![murderd](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@murderd](https://forum.kirupa.com/u/murderd)\
**Post date:** [February 27, 2006, 6:42pm UTC](https://forum.kirupa.com/t/all-actionscript-scrollbar-issue/180308/1 "2006-02-27T18:42:49Z")

</div>

semi working flash movie: [http://198.104.154.25/](http://198.104.154.25/)  
here is my fla: [http://198.104.154.25/scroller.fla](http://198.104.154.25/scroller.fla)  
OK this is the most perplexing action script problem i have ever had. i am desperately trying to solve this problem. my scroller works, but goes up too far, and does not act correctly. if someone can point me in the right direction, i will be VERY happy. the whole entire script is contained within the main movie. there are no frames. just the clips, thats all.

```auto
// ----------------
// scroller.fla
// murderd@gmail.com
// ----------------
// function to scroll any movieclip, based on soome input variables
    // myScrollable - movieclip to scroll
    // myMask - mask to be used for the scrollable movieclip
    // myScrollbar - scrollbar movieclip
    // myGutter - 'gutter' or bounding box for the scrollbar
    // a - speed for the scroller
    // d - damping for the scroller after being released
    // targY - new _y position for the scrollable movieclip
// --------------------

function justScrollIt(myScrollable:MovieClip, myMask:MovieClip, myScrollbar:MovieClip, myGutter:MovieClip, a:Number, d:Number, targY:Number) {
    // ------------------------------
    myYspeed = myScrollable._y;
    myScrollbar.useHandCursor = false;
    // the 'gutter' or bounding box which the scrollbar resides in
    // next version, 'myGutter' will be the bounding box, and these vars will be grabbed from there
    gutterLeft = myScrollbar._x;
    gutterTop = 0;
    //gutterTop = myGutter._y - (myGutter._height/2) + (myScrollbar._height/2);
    gutterRight = myScrollbar._x;
    gutterBottom = myGutter._y + (myGutter._height/2) - (myScrollbar._height/2);
    // ------------------------------
    myScrollbar.onPress = function(){
        startDrag(myScrollbar, false, gutterLeft, gutterTop, gutterRight, gutterBottom);
    }
    //stop the drag
    myScrollbar.onRelease = REF.scrollbar_mc.onReleaseOutsi
de = function() {
        stopDrag();
    }
    // ------------------------------
    //set the mask for the text
    myScrollable.setMask(myMask);
    // ------------------------------
    myScrollable.onEnterFrame = function(){
        scrollAmount = (myScrollable._height - (myMask._height/1.3))/(myMask._height - myScrollbar._height);
        //set a new target y position
        targY =- myScrollbar._y * scrollAmount;
        myYspeed = ((Math.round(myScrollable._y) - Math.round(targY))/a+Math.round(myYspeed))/d;
        myScrollable._y -= myYspeed;
    }
    // ------------------------------
}

// call the scroller function
justScrollIt(scrollable_mc, mask_mc, scrollbar_mc, gutter_mc, 8, 8, 0);

```

* * *

regards,  
-edward hotchkiss
