Tutorial Navigation
 

     
 Links
 

 
.

 

 Search         Date   
      

SwishMax
:  Text Scroll Basic with scrollbar, 
December 12, 2004  -  by Johnny  
Text Scroll Using Scrollbar
TEXTOBJ: object that will contain the Text file
SPRITEcontrol: (control object for scroll up and down)

CIRCLE: Object to drag up and down to create the scrolbar effect.
BOT: Bottom Object
TOP: Top Object



View Sample Below

























mytext.txt,TextScroll.swi and Textscroll.html are included in the Download file.

To load the text into the object the TEXTOBJECT must has a varibale name, (use the advanced option)
we assigned the name mytext, so that mean our TXT file must has the format &mytext=..............

Just load your text file and any time at any moment

Code used in the object CIRCLE:
onLoad () {
    DRAGGING=0;
    ysize=262-21;
}
onSelfEvent (press) {
    startDragUnlocked(0,0,21,264);
    DRAGGING=1;
}
onSelfEvent (release,dragOut,releaseOutside) {
    stopDrag();
    DRAGGING=0;
}
onEnterFrame() {
    if (DRAGGING==1) {
        _parent._parent.TEXTOBJ.SCROLL = (( (_y-21) * (_parent._parent.TEXTOBJ.maxscroll -1) ) / ysize)+1;
    }
}
Code used in the object BOT:
onLoad () {
    scrollBOT=0;
}
onEnterFrame() {
    if (scrollBOT==1) {
        _parent._parent.TEXTOBJ.scroll+=1;
        _parent.circle._y=math.round((_parent._parent.TEXTOBJ.SCROLL * _parent.Circle.ysize  /  _parent._parent.TEXTOBJ.MAXSCROLL)+23);
    }
}
onSelfEvent (press) {
    ScrollBOT=1;
}
onSelfEvent (release,dragOut) {
    ScrollBOT=0;
}
Code used in the object TOP:
onLoad () {
    scrollTOP=0;
}
onEnterFrame() {
    if (scrollTOP==1) {
        _parent._parent.TEXTOBJ.scroll-=1;
        _parent.circle._y=math.round(((_parent._parent.TEXTOBJ.SCROLL-1) * _parent.Circle.ysize / (_parent._parent.TEXTOBJ.MAXSCROLL))+21);
    }
}
onSelfEvent (press) {
    ScrollTOP=1;
}
onSelfEvent (release,dragOut) {
    ScrollTOP=0;
}

Will be easy give another look to your scrollbar.
Download the sample and test.

    Total Download: 183 Last Download: 3/02/2010

.

     
 Featured Links