# Loading a text box and scrolling

**URL:** <https://forum.kirupa.com/t/loading-a-text-box-and-scrolling/97334>\
**Category:** Uncategorized\
**Created:** [December 20, 2003, 10:02pm UTC](https://forum.kirupa.com/t/loading-a-text-box-and-scrolling/97334 "2003-12-20T22:02:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisdb89](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@chrisdb89](https://forum.kirupa.com/u/chrisdb89)\
**Post date:** [December 20, 2003, 10:02pm UTC](https://forum.kirupa.com/t/loading-a-text-box-and-scrolling/97334/1 "2003-12-20T22:02:56Z")

</div>

I have the code to scroll a text box:

//  
// note : everything is dependent upon the size of the textfield on the stage  
//  
ST = mov\_scroller.mov\_thumb; // common path reference  
//  
init\_scroll = function(){  
// integers in here CAN be created dynamically. I was lazy. :]  
with(mov\_frame){  
// put an arbitrary space around textfield  
\_x = txt\_display.\_x-5;  
\_y = txt\_display.\_y-5;  
\_height = txt\_display.\_height+10;  
\_width = txt\_display.\_width+10;  
}  
with(mov\_scroller){  
mov\_thumb.\_height=mov\_frame.\_height/7;  
// one btn down=12  
\_y=mov\_frame.\_y+12;  
// half the dist of scroller=6  
\_x=mov\_frame.\_x+mov\_frame.\_width+6;  
// up two btns=24  
mov\_down.\_y=mov\_frame.\_height-24;  
mov\_track.\_height = btn\_bg.\_height = mov\_frame.\_height-24;  
// get the max and min values so we know where to stop the scroller  
// store them as a var within ‘thumb’  
mov\_thumb.int\_min=mov\_thumb.\_y;  
mov\_thumb.int\_max=Math.ceil(mov\_track.\_height-mov\_thumb._height);  
}  
// place load btns : purely aesthetic!  
for(var i=0;i\<=2;i++){  
this['btn_’+i].\_x=mov\_frame._x;  
this['btn_’+i].\_y=mov\_frame._y+(i\*(this['btn_’+i].\_height+5));  
}  
// used for scroll and drag  
int\_scrollDist = Math.ceil(mov\_scroller.mov\_track.\_height-ST.\_height);  
};  
// init  
init\_scroll();  
// load function  
loadText\_old = function(toLoad){  
loadVariables(toLoad, \_root);  
\_root.gotoAndPlay(‘swonk’);  
ST.\_y = ST.int\_min;  
};

// set a var to check if the user clicked anywhere on the scroller  
// other than the btns or the thumb for use with…  
mov\_scroller.btn\_bg.onPress=function(){  
boo\_scrollClk=1;  
};  
mov\_scroller.btn\_bg.onRelease=mov\_scroller.btn\_bg.onReleaseOutside=function(){  
boo\_scrollClk=0;  
};  
// …this  
// track event handler: for click other than dragScroll or use of btns  
mov\_scroller.mov\_track.onEnterFrame = function(){  
// Subtraction and addition : when you click and hold,  
// the thumb falls in the middle of the mouse click.  
// take out ‘-(ST.\_height+(ST.\_height/2))’ and see where it stops  
point={y:\_root.\_ymouse-(ST.\_height+(ST.\_height/2))};  
if(boo\_scrollClk){  
globalToLocal(point.y);  
/_\>\> bug fix : set zones \<\<_/  
if(point.y\<=ST.\_height && point.y\>=ST.int\_min){  
// click is in the upper zone of track  
var d = (ST.int\_min)-ST.\_y;  
}else if(point.y\<=int\_scrollDist){  
// …mid zone  
var d = (point.y)-ST.\_y;  
}else{  
// …lower zone  
var d = (ST.int\_max)-ST.\_y;  
}  
// update thumb  
ST.\_y+=d/5;  
// check so scroller can’t keep dragging up if user holds down mouse  
if(ST.\_y\<=ST.int\_min) boo\_scrollClk=0;  
}  
};  
//  
// scroller event handler  
mov\_scroller.onEnterFrame = function() {  
str\_display.scroll = Math.round((this.mov\_thumb.\_y/int\_scrollDist)\*str\_display.maxscroll);  
};  
// hide hand from all buttons : optional  
Button.prototype.useHandCursor=0;

//

and i have the code to load the text into a text box:  
loadVariablesNum(“[http://tcbp.t35.com/tcbp/new/updates.txt](http://tcbp.t35.com/tcbp/new/updates.txt)”, 0);

When i view the .swf file in the flash program (CTRL + ENTER) i can see the text, but once i upload it to my site (hosted at [t35.com](http://t35.com)) the text is not there.

what is wrong??

Thanks
