Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actionscript failing in my scrollbar

Status
Not open for further replies.

jamiebettles

Technical User
Dec 15, 2005
23
DE
Hello. I'm making a very small and simple flash website and have made a scrollbar which works almost perfectly. When manually selecting the 'scrollbox' and moving it up and down it stops exactly at the top and bottom of the scrolltrack. the 'up' arrow also works perfectly but when pressing the 'down' arrow the scrollbox always over-shoots the end of the scrolltrack. Here is the link to what I've made so far so anyone can see for themself:


There is a lot of actionscript involved both in the main stage and in each component of the scrollbar so for now i wont post all the script. If it's impossible to work out whats going wrong without seeing the actionscript then please let me know and i'll go ahead and post it. Thanks very much to anyone who can be of assistance.

Jamie
 
ok, here's the script from scene one which regulates the stopping points of the scrollbox...

ms = textbox.Message.maxscroll;
scale = scrollheight/ms;
if (ms>1) {
if (!dragpress) {
textbox.scrollbar.scrollbox._yscale = 2000/textbox.Message.maxscroll;
textbox.scrollbar.scrollbox._y = -(scrollheight/2)+((textbox.Message.scroll-1)*scale);
if (!textbox.scrollbar._visible) {
textbox.scrollbar._visible = true;
}
textbox.scrollbar.scrollbox._y = boxypos
} else if (textbox.scrollbar.scrollbox._y<-(scrollheight/2)+1 and move<0) {
move = 0;
textbox.scrollbar.scrollbox._y = -(scrollheight/2);
} else if (textbox.scrollbar.scrollbox._y+textbox.scrollbar.scrollbox._height>(scrollheight/2)-1 and move>0) {
move = 0;
textbox.scrollbar.scrollbox._y = scrollheight/2;
} else {
scrollfix = textbox.Message.scroll = ((textbox.scrollbar.scrollbox._y+(scrollheight/2))/scale)+1;
boxypos = textbox.scrollbar.scrollbox._y = textbox.scrollbar.scrollbox._y+(move*scale);
}

}

And here is the script from the bottom arrow that is misbehaving...

on (press) {
if (_parent._parent.textbox.Message.scroll<_parent._parent.textbox.Message.maxscroll) {
_parent._parent.dragpress = 1;
_parent._parent.move = 1;
}
if (_parent._parent.textbox.Message.maxscroll) {
_parent._parent.move = 0;
}
}
on (release) {
_parent._parent.dragpress = 0;
_parent._parent.move = 0;
}
I'll get onto posting the .fla thanks jamie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top