Kirupa Scroll needs an anchor (code by Kirupa Chinnathambi)

Hi all,

I am actually using a scrollBar from here and it is working very well (there is a tutorial by Kirupa Chinnathambi about it on here - thanks!). However I need to modify it to go to a certain y position in certain circumstances. I have everything working on the site but this function.

What happens is that the scroll bar does not know when the MovieClip ends or begins so there is awkward space below the MovieClip or you cannot see all the moviclips after you scroll past certain points. I think I need to modify the top and bottom in the variables. But does someone have any info on how to do this… correctly?

I was thinking that you would be able to pass in the contentMain._y and then do a little adding and subtracting of the variables and presto - the thing works. But my trials have lead to tribulations and I believe I am beginning to age more quickly - so I would love to find a solution to this problem before too much time passes. If someone has a solution I would much appreciate you getting me back on the glass half full side of life.

Thanks!!!

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._y = Math.round(dy*-1*moveVal+initContentPos);
trace(“contentHeight” + contentHeight);
trace(“scrollFaceHeight” + scrollFaceHeight);
trace(“scrollFace” + scrollFace._y);
trace(“contentMain._y” + contentMain._y);
trace(“bottom” + bottom);
trace(“moveVal” + moveVal);
trace(“initContentPos” + initContentPos);

//contentMain._y = 291.0;
//scrollFace._y = 393;

    };
};
scrollFace.onMouseUp = function() {
    stopDrag();
    delete this.onMouseMove;
};
btnUp.onPress = function() {
    this.onEnterFrame = function() {
        if (contentMain._y+speed<maskedView._y) {
            if (scrollFace._y<=top) {
                scrollFace._y = top;
            } else {
                scrollFace._y -= speed/moveVal;
            }
            contentMain._y += speed;
        } else {
            scrollFace._y = top;
            contentMain._y = maskedView._y;
            delete this.onEnterFrame;
        }
    };
};
btnUp.onDragOut = function() {
    delete this.onEnterFrame;
};
btnUp.onRelease = function() {
    delete this.onEnterFrame;
};
btnDown.onPress = function() {
    this.onEnterFrame = function() {
        if (contentMain._y-speed>finalContentPos) {
            if (scrollFace._y>=bottom) {
                scrollFace._y = bottom;
            } else {
                scrollFace._y += speed/moveVal;
            }
            contentMain._y -= speed;
        } else {
            scrollFace._y = bottom;
            contentMain._y = finalContentPos;
            delete this.onEnterFrame;
        }
    };
};
btnDown.onRelease = function() {
    delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
    delete this.onEnterFrame;
};

if (contentHeight<maskHeight) {
    scrollFace._visible = false;
    btnUp.enabled = false;
    btnDown.enabled = false;
} else {
    scrollFace._visible = true;
    btnUp.enabled = true;
    btnDown.enabled = true;
}

};
scrolling();