
November 17th, 2003, 01:01 AM
|
|
Contributing User
|
|
Join Date: Feb 2002
Posts: 599
Time spent in forums: 2 Days 3 h 46 m 49 sec
Reputation Power: 7
|
|
|
Scrollbox issues
HI,
I'm trying to edit some flash in order to increase the length that a scrollbox can actually scroll the txt contained in it. Code is as follows:
PHP Code:
onClipEvent (load) {
this.loadVariables("textedit/datafiles/bio");
scrolling = 0;
frameCounter = 1;
speedFactor = 3;
numLines = 20;
origHeight = scrollbar._height;
origX = scrollbar._x;
needInit = false;
function initScrollbar() {
var totallines = numlines+bio.maxscroll-1;;
scrollbar._yscale = 100*(numLines)/totalLines;
deltaHeight = origHeight-scrollbar._height;
lineHeight = deltaheight/(bio.maxscroll-1);
}
function updateScrollBarPos() {
scrollbar._y = lineheight*(bio.scroll-1);
}
}
onClipEvent (enterFrame) {
if (needInit) {
if (bio.maxscroll>1) {
initScrollbar();
needInit = false;
}
}
if (frameCounter%speedFactor == 0) {
if (scrolling == "up" && bio.scroll>1) {
bio.scroll--;
updateScrollBarPos();
} else if (scrolling == "down" && bio.scroll<bio.maxscroll) {
bio.scroll++;
updateScrollBarPos();
}
frameCounter = 0;
}
frameCounter++;
}
onClipEvent (mouseDown) {
if (up.hitTest(_root._xmouse, _root._ymouse)) {
scrolling = "up";
frameCounter = speedFactor;
up.gotoAndStop(2);
}
if (down.hitTest(_root._xmouse, _root._ymouse)) {
scrolling = "down";
frameCounter = speedFactor;
down.gotoAndStop(2);
}
if (scrollbar.hitTest(_root._xmouse, _root._ymouse)) {
scrollbar.startDrag(0, origX, deltaHeight, origX);
scrolling = "scrollbar";
}
updateAfterEvent();
}
onClipEvent (mouseUp) {
scrolling = 0;
up.gotoAndStop(1);
down.gotoAndStop(1);
stopDrag();
updateAfterEvent();
}
onClipEvent (mouseMove) {
if (scrolling == "scrollbar") {
bio.scroll = Math.round((scrollbar._y)/lineHeight+1);
}
updateAfterEvent();
}
onClipEvent (data) {
needInit = true;
}
I'm not all that up on this sort of thing (not my code.. handed over to me from previous dev) so I'm having a problem figuring out what I should edit to make the box able to scroll through all the text I want to insert into it.
Could anyone offer an opinion?
|