# How can I make a Scrollbar load ONLY when it's needed?

**URL:** <https://forum.kirupa.com/t/how-can-i-make-a-scrollbar-load-only-when-its-needed/58052>\
**Category:** flash\
**Created:** [July 19, 2004, 12:59pm UTC](https://forum.kirupa.com/t/how-can-i-make-a-scrollbar-load-only-when-its-needed/58052 "2004-07-19T12:59:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![orionstar](https://avatars.discourse-cdn.com/v4/letter/o/51bf81/32.png) [@orionstar](https://forum.kirupa.com/u/orionstar)\
**Post date:** [July 19, 2004, 12:59pm UTC](https://forum.kirupa.com/t/how-can-i-make-a-scrollbar-load-only-when-its-needed/58052/1 "2004-07-19T12:59:49Z")

</div>

Hey guys,

I have checked out Kirupa’s great tutorial on this, but that was based on an input box and then a “result box”.

I would just like to make a simple dynamic text boxt that loads a scrollbar automatically when it is needed , and NOT show when it is not needed.  
Could anyone please point me towards any simple code for that?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 1:46pm UTC](https://forum.kirupa.com/t/how-can-i-make-a-scrollbar-load-only-when-its-needed/58052/2 "2004-07-19T13:46:30Z")

</div>

Here are a couple examples, I think I got them both here? Top one also loads your txt file.

OCP\_Content = new LoadVars();  
OCP\_Content.load("./text/OCP\_gettingConnected.txt");  
OCP\_Content.onLoad = function(success) {  
if (success) {  
myText.htmlText = OCP\_Content.ocp;  
//Hide or View the Scroll Bar  
myText.maxscroll != 1 ? scrollBar.\_visible=true : scrollBar.\_visible=false;  
}  
};

//Hide or View the Scroll Bar Non Dynamic Text  
scrollBar.\_visible = (myText.maxscroll = 1);  
myText.onChanged = function() {  
scrollBar.\_visible = (this.maxscroll \> 1);  
};

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 7:04pm UTC](https://forum.kirupa.com/t/how-can-i-make-a-scrollbar-load-only-when-its-needed/58052/3 "2004-07-19T19:04:26Z")

</div>

Just what I needed! Thanks garyzero!
