Hi.
I really like this particular scroller I used at the bottom of the page here:
Now I need to use two instances of it side by side on another page and can not get it to work.
I have tried:
- Having same code twice in frame 1 unchangend.
- Having two instances of all the code but with renamed variables and instance names throughout the code.
- Having each scroller in their own movie clip and then add them both to the scene.
- Having a master fla with the background and importing two separate swfs with each their own scroller - they work independantly but when they import to the same page one of them will not work.
Here is the AS2 I am using:
Left scroller:
fscommand("allowscale", "true");
bar.useHandCursor = dragger.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._heig ht) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y == y+bar._height-dragger._height && d == 1) || (dragger._y == y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
dragger.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};
Right scroller
fscommand("allowscale", "true");
bar2.useHandCursor = dragger2.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger2._y;
top = main2._y;
bottom = main2._y+mask_mc._height-main2._height-space;
dragger2.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar2._height-this._height);
scrollEase();
};
dragger2.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar2.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger2._hei ght) {
this._parent.dragger2._y = this._parent._ymouse;
this._parent.dragger2._y = this._y+this._height-this._parent.dragger2._height;
} else {
this._parent.dragger2._y = this._parent._ymouse;
}
scrollEase();
};
bar2.onMouseUp = function() {
drag = false;
};
movedragger2 = function (d) {
if ((dragger2._y == y+bar2._height-dragger2._height && d == 1) || (dragger2._y == y && d == -1)) {
clearInterval(myInterval);
} else {
dragger2._y += d;
scrollEase();
updateAfterEvent();
}
};
up_btn2.onPress = function() {
myInterval = setInterval(movedragger2, 18, -1);
};
down_btn2.onPress = function() {
myInterval = setInterval(movedragger2, 18, 1);
};
up_btn2.onMouseUp = down_btn2.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
dragger2.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar2._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main2._y)/speed)*friction);
main2._y += dy;
};
};
If needed I can upload the fla files, but I see no option to attach a file
Thank you on beforehand!
ggaarde