How can I put 2 scrollbars (by Claudio) on 1 page? I tried to change all the instance names of the buttons, main, mask, bar and dragger but now it freaks :s.
scrollbar1:
fscommand("allowscale", "false");
bis_bar.useHandCursor = bis_dragger.useHandCursor = false;
space = 20;
friction = 0.9;
speed = 4;
y = bis_dragger._y;
top = bis_main._y;
bottom = bis_main._y+bis_mask_mc._height-bis_main._height-space;
bis_dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bis_bar._height-this._height);
bis_dragger.scrollEase();
};
bis_dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bis_bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.bis_dragger._height) {
this._parent.bis_dragger._y = this._parent._ymouse;
this._parent.bis_dragger._y = this._y+this._height-this._parent.bis_dragger._height;
} else {
this._parent.bis_dragger._y = this._parent._ymouse;
}
bis_dragger.scrollEase();
};
bis_bar.onMouseUp = function() {
drag = false;
};
movebis_dragger = function (d) {
if ((bis_dragger._y>=y+bis_bar._height-bis_dragger._height && d == 1) || (bis_dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
bis_dragger._y += d;
bis_dragger.scrollEase();
updateAfterEvent();
}
};
bis_up_btn.onPress = function() {
myInterval = setInterval(movebis_dragger, 18, -1);
};
bis_down_btn.onPress = function() {
myInterval = setInterval(movebis_dragger, 18, 1);
};
bis_up_btn.onMouseUp = bis_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)/(bis_bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-bis_main._y)/speed)*friction);
bis_main._y += dy;
};
};
scrollbar2:
fscommand("allowscale", "false");
sub_bar.useHandCursor = sub_dragger.useHandCursor = false;
space = 20;
friction = 0.9;
speed = 4;
y = sub_dragger._y;
top = sub_main._y;
bottom = sub_main._y+sub_mask_mc._height-sub_main._height-space;
sub_dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.sub_bar._height-this._height);
sub_dragger.scrollEase();
};
sub_dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
sub_bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.sub_dragger._height) {
this._parent.sub_dragger._y = this._parent._ymouse;
this._parent.sub_dragger._y = this._y+this._height-this._parent.sub_dragger._height;
} else {
this._parent.sub_dragger._y = this._parent._ymouse;
}
sub_dragger.scrollEase();
};
sub_bar.onMouseUp = function() {
drag = false;
};
movesub_dragger = function (d) {
if ((sub_dragger._y>=y+sub_bar._height-sub_dragger._height && d == 1) || (sub_dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
sub_dragger._y += d;
sub_dragger.scrollEase();
updateAfterEvent();
}
};
sub_up_btn.onPress = function() {
myInterval = setInterval(movesub_dragger, 18, -1);
};
sub_down_btn.onPress = function() {
myInterval = setInterval(movesub_dragger, 18, 1);
};
sub_up_btn.onMouseUp = sub_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)/(sub_bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-sub_main._y)/speed)*friction);
sub_main._y += dy;
};
};
greetz jakke