PDA

View Full Version : Scroller


stylin328
09-07-2005, 05:48 PM
Hey guys, well I found some scripts for scrollers and I got it to work, my only problem now is on the actualy scroll line. The bar goes to the bottom of the page and not to the end of the line. Ive tried playing with the scripting but cant figure out where the place is to change it. Can someone help me out? Ive attached the fla and here is the script: Thanks so much


// set up content_mc info
contentRight = _parent.content_mc._y;
//moves who moveclip down to bottom so as more port happens move this number
contentLeft = 100-_parent.content_mc._height;
// set up gutter info
gutterLeft = _parent.scrollbarGutter_mc._y-22;//top of slider
gutterRight = ((_parent.scrollbarGutter_mc._y+_parent.scrollbarG utter_mc._height)-this._height)-1;
// don't use the hand icon
this.useHandCursor = true;
// handle press event
this.onPress = function() {
this.startDrag(false, this._x, gutterLeft, this._x, gutterRight);
dragging = true;
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
this.onRelease = this.onReleaseOutside=function () { this.onMouseMove = undefined;this.stopDrag();dragging = false;ySpeed = (newypos-oldypos)*RATIO;};
// set initial variables
FRICTION = .292;
RATIO = .3;
dragging = false;
// handle onEnterFrame event
this.onEnterFrame = function() {
if (!dragging) {
oldypos = this._y;
newypos = oldypos+ySpeed;
ySpeed *= FRICTION;
if (newypos>gutterRight || newypos<gutterLeft) {
ySpeed *= -FRICTION;
newypos = oldypos;
}
this._y = newypos;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.conten t_mc._y)+0.0;
} else {
oldypos = newypos;
newypos = this._y;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.conten t_mc._y)+0.0;
}
};