# Multiple scrollbars

**URL:** https://forum.kirupa.com/t/multiple-scrollbars/166742
**Category:** Uncategorized
**Created:** [October 22, 2005, 11:31am UTC](https://forum.kirupa.com/t/multiple-scrollbars/166742 "2005-10-22T11:31:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ckm](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@ckm](https://forum.kirupa.com/u/ckm)
#### Post date: [October 22, 2005, 11:31am UTC](https://forum.kirupa.com/t/multiple-scrollbars/166742/1 "2005-10-22T11:31:07Z")

</div>

Hi Guys.

I have been trying to solve this problem for two days (Tells ya alot, eh?) and have searched multiple forums.

Anyway, I have 3 dynamically loaded text boxes with three separate scrollbars. I have changed code to adjust, but I am missing something.

Independently all three boxes work good. But when I put two or more together they scroll only one box.

I am trying to solve this problem for a client before I am “forced” to go North. I have until 8 am tomorrow (Sunday, October 22).

Thank you so much.  
ckm

I can’t get the file to upload. It is .09 MB to big.

Here is the code

**1. This is one box (MC: Redbox)**  
fscommand(“allowscale”, “false”);  
bar3.useHandCursor = help.useHandCursor=true;  
space3 = 20;  
friction3 = 0.9;  
speed3 = 4;  
y3 = help.\_y;  
top3 = leftRedbox.\_y;  
help.onPress = function() {  
drag3 = true;  
this.startDrag(false, this.\_x, this.\_parent.y3, this.\_x, this.\_parent.y3+this.\_parent.bar3.\_height-this.\_height);  
help.scrollEase();  
};  
help.onMouseUp = function() {  
this.stopDrag();  
drag3 = false;  
};  
bar3.onPress = function() {  
drag3 = true;  
if (this.\_parent.\_ymouse\>this.\_y3+this.\_height-this.\_parent.help.\_height) {  
this.\_parent.help.\_y = this.\_y3+this.\_height-this.\_parent.help.\_height;  
} else {  
this.\_parent.help.\_y = this.\_parent.\_ymouse;  
}  
help.scrollEase();  
};  
bar3.onMouseUp = function() {  
drag3 = false;  
};  
moveDragger = function (d3) {  
if ((help.\_y\>=y3+bar3.\_height-help.\_height && d3 == 1) || (help.\_y\<=y3 && d3 == -1)) {  
clearInterval(myInterval);  
} else {  
help.\_y += d3;  
help.scrollEase();  
updateAfterEvent();  
}  
};  
upB3.onPress = function() {  
my3Interval = setInterval(moveDragger, 18, -1);  
};  
downB3.onPress = function() {  
my3Interval = setInterval(moveDragger, 18, 1);  
};  
upB3.onMouseUp = downB3.onMouseUp=function () {  
clearInterval(my3Interval);  
};  
MovieClip.prototype.scrollEase = function() {  
this.onEnterFrame = function() {  
if (Math.abs(dy3) == 0 && drag3 == false) {  
delete this.onEnterFrame;  
}  
r3 = (this.\_y-y3)/(bar3.\_height-this.\_height);  
dy3 = Math.round((((top3-(top3-bottom3)\*r3)-leftRedbox.\_y)/speed3)\*friction3);  
leftRedbox.\_y += dy3;  
};  
};  
//tell Flash to display special characters  
System.useCodepage=true;  
redText = new loadVars();  
redText.load(“red.txt”);  
redText.onLoad = function(success3) {  
if (success3) {  
//trace(“data loaded sucessfully”);  
\_root.Redbox.leftRedbox.leftRedtext.html = true;  
\_root.Redbox.leftRedbox.leftRedtext.htmlText = this.redmain;  
bottom3 = leftRedbox.\_y+mask3-mc.\_height-leftRedbox.\_height-space3;  
} else {  
//trace(“data did not load.”);  
}  
};

**This is for the leftRedText**  
\_root.Redbox.leftRedbox.leftRedtext.autoSize= “left”

**2. This is for MC-Purplebox:**  
fscommand(“allowscale”, “false”);  
bar2.useHandCursor = dragger2.useHandCursor=true;  
space = 20;  
friction = 0.9;  
speed = 4;  
y = dragger2.\_y;  
top = leftPurplebox.\_y;  
dragger2.onPress = function() {  
drag = true;  
this.startDrag(false, this.\_x, this.\_parent.y, this.\_x, this.\_parent.y+this.\_parent.bar2.\_height-this.\_height);  
dragger2.scrollEase();  
};  
dragger2.onMouseUp = function() {  
this.stopDrag();  
drag = false;  
};  
bar2.onPress = function() {  
drag = true;  
if (this.\_parent.\_ymouse\>this.\_y+this.\_height-this.\_parent.dragger2.\_height) {  
this.\_parent.dragger2.\_y = this.\_y+this.\_height-this.\_parent.dragger2.\_height;  
} else {  
this.\_parent.dragger2.\_y = this.\_parent.\_ymouse;  
}  
dragger2.scrollEase();  
};  
bar2.onMouseUp = function() {  
drag = false;  
};  
moveDragger = function (d) {  
if ((dragger2.\_y\>=y+bar2.\_height-dragger2.\_height && d == 1) || (dragger2.\_y\<=y && d == -1)) {  
clearInterval(myInterval);  
} else {  
dragger2.\_y += d;  
dragger2.scrollEase();  
updateAfterEvent();  
}  
};  
up\_btn2.onPress = function() {  
purpleInterval = setInterval(moveDragger, 18, -1);  
};  
down\_btn2.onPress = function() {  
purpleInterval = setInterval(moveDragger, 18, 1);  
};  
up\_btn2.onMouseUp = down\_btn2.onMouseUp=function () {  
clearInterval(purpleInterval);  
};  
MovieClip.prototype.scrollEase = function() {  
this.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)-leftPurplebox.\_y)/speed)\*friction);  
leftPurplebox.\_y += dy;  
};  
};  
//tell Flash to display special characters  
System.useCodepage=true;  
loadText = new loadVars();  
loadText.load(“purple.txt”);  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
\_root.Purplebox.leftPurplebox.leftPurpletext.html = true;  
\_root.Purplebox.leftPurplebox.leftPurpletext.htmlText = this.purplemain;  
bottom = leftPurplebox.\_y+mask2-mc.\_height-leftPurplebox.\_height-space;  
}  
};

**This is for the leftPurpleText**  
\_root.Purplebox.leftPurplebox.leftPurpletext.autoSize= “left”

**3. This is for MC-Box:**  
fscommand(“allowscale”, “false”);  
bar.useHandCursor = dragger.useHandCursor=true;  
space = 20;  
friction = 0.9;  
speed = 4;  
y = dragger.\_y;  
top = main.\_y;  
dragger.onPress = function() {  
drag = true;  
this.startDrag(false, this.\_x, this.\_parent.y, this.\_x, this.\_parent.y+this.\_parent.bar.\_height-this.\_height);  
dragger.scrollEase();  
};  
dragger.onMouseUp = function() {  
this.stopDrag();  
drag = false;  
};  
bar.onPress = function() {  
drag = true;  
if (this.\_parent.\_ymouse\>this.\_y+this.\_height-this.\_parent.dragger.\_height) {  
this.\_parent.dragger.\_y = this.\_y+this.\_height-this.\_parent.dragger.\_height;  
} else {  
this.\_parent.dragger.\_y = this.\_parent.\_ymouse;  
}  
dragger.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;  
dragger.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() {  
this.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;  
};  
};  
//tell Flash to display special characters  
System.useCodepage=true;  
primaryInfo = new loadVars();  
primaryInfo.Load(“main.txt”);  
primaryInfo.onLoad = function(success) {  
if (success) {  
// trace(success);  
\_root.contents.Box.main.maininfo.html = true;  
\_root.contents.Box.main.maintitle.html = true;  
\_root.contents.Box.main.maintitle.htmlText = this.maintitle;  
\_root.contents.Box.main.maininfo.htmlText = this.maininfo;  
bottom = main.\_y+mask\_mc.\_height-main.\_height-space;  
}  
};

**This is for the maininfo**  
\_root.contents.Box.main.maininfo.autoSize= “left”
