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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Scroll 2

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
Ewan or anyone else we talked about this in a thread a whilke back. I have sime scrolling textcontrlloed by a clip as followed:

onClipEvent (load) {
var speed = 1;
}
onClipEvent (enterFrame) {
if (scrollD == "up") {
_parent.txt.scroll -= speed;
} else if (scrollD == "down") {
_parent.txt.scroll += speed;
}
}

Button that scolls the text:

on(press) {
control.scrollD = "up";
}
on(release) {
control.scrollD = false;
}
(Compliments of bigbaddave)

Now what I wanted to do is slow down the scroll. Ewan you suggested that I change the 1 to .5 or something but if I do that then the scroll doesn't work.

Any suggestion on how to smooth this scroll up and slow it down as well. Or do you have another scroll script lying around I could drop in?

---------------------------------------------
 
A .5 speed (or anything less than 1) will work but you have to add in an extra stage:

Code:
 onClipEvent (load) {
	var speed = .5;
}
onClipEvent (enterFrame) {
	if (scrollD == "up") {
		scrollPoint -= speed;
		_parent.txt.scroll = Math.floor(scrollPoint);
	}
	else if (scrollD == "down") {
		scrollPoint += speed;
		_parent.txt.scroll = Math.floor(scrollPoint);
	}
}
 
I've allways liked this one. No buttons but nice easing and you can scroll it as fast or as slow as you want.


Regards,

cubalibre2.gif
 
You could load the text into a field inside a movieclip and then use the scroll buttons to move the clip's _y position which means you could have a pixel-by-pixel scroll. Would be very smooth but not as flexible.

Or in MX you can treat the textfield as a clip, embed the font and use a mask to show the parts you want to display.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top