Hello,
I am trying to build a vertical slide scroller based on a tutorial for a horizontal slide scroller and am having difficulties undertanding what values I need to change in the code for the slider mc in order to make it work. The horizontal slider is quite smart and there is additonal functionality attached to it to affect it’s movement which I’m not too worried about although it would be nice)
I would be ever so grateful for some help. I’ve attached the code for the horizontal scroller which I hope to amend
Big thanks in advance
Bev
// set up content_mc info
contentRight = _root.content_mc._x;
contentLeft = 715-_root.content_mc._width;
// set up gutter info
gutterLeft = _root.scrollbarGutter_mc._x+1;
gutterRight = ((_root.scrollbarGutter_mc._x+_root.scrollbarGutter_mc._width)-this._width)-1;
// don't use the hand icon
this.useHandCursor = false;
// handle press event
this.onPress = function() {
this.startDrag(false, gutterLeft, this._y, gutterRight, this._y);
dragging = true;
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
this.onRelease = this.onReleaseOutside = function() {
this.onMouseMove = undefined;
this.stopDrag();
dragging = false;
xSpeed = (newxpos-oldxpos)*RATIO;
};
// set initial variables
FRICTION = .9;
RATIO = .5;
dragging = false;
// handle onEnterFrame event
this.onEnterFrame = function() {
if (!dragging) {
oldxpos = this._x;
newxpos = oldxpos+xSpeed;
xSpeed *= FRICTION;
if (newxpos>gutterRight || newxpos<gutterLeft) {
xSpeed *= -FRICTION;
newxpos = oldxpos;
}
this._x = newxpos;
// always move content_mc whether dragging or not
var percent = (this._x-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._x = percent*(contentLeft-contentRight)+contentRight;
} else {
oldxpos = newxpos;
newxpos = this._x;
// always move content_mc whether dragging or not
var percent = (this._x-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._x = percent*(contentLeft-contentRight)+contentRight;
}
};