Scrolling text field buttons - Novice

Currently, I have arrow buttons that scroll the text field when they are clicked. What script do I use to scroll the textfield as the button is held down? As opposed to clicking it each time to go down or up. Even to mouse over the arrow buttons to scroll would be nice.

Here is my current script:


I am currently using VARs (to dynamically load external data) on my dyn text boxes so it would have to be something that calls the instance name of the dyn text box.



And here is the other script on the buttons:

-Up Button-

on (press) {
scrollbarleft.scroll -= 1; }

-Down Button-

on (press) {
scrollbarleft.scroll += 1; }

This would work great if I was not already dynamically loading external text into my dynamic text field. I am using VARS in this case.

What I require are simple arrow buttons that scroll the text field (instance name of “infotxt”) up and down when moused over.

Can you provide another direction?


It works with dynamically loaded text.

I can see by this code:

set (myTextField, “put a bunch of text here”);

it does not implement with my project since the text is externally loaded from a text file

Ignore that line if you are loading external text.

Excellent code Claudio. I implemented it and its functional. However, it is choppy and not smooth scrolling. I changed the scroll speed to 150 and then 200 because at 80 it is way too fast. Can you assist me with getting it to scroll smooth?

It wont, if your frame rate is at 12FPS and the scroll speed is set to 200 it will be choppy.
Lower the speed value to around 100.

My fps is at 22. Would it be a good idea to lower the fps?

No, the FPS is fine. But using the speed at 200 will be choppy.
Try something around 120 - 150.

Hmmm, I tried those settings. It scrolls to fast now. I have seen smooth scrolling before. Is different code required?

If you scroll using the textfield.scroll property, it will be hard to achieve a slower smooth scroll, since you can only increment or decrement the scroll position by integers.
There are other methods, here i attached an example: