# \[FMX\] scrolling

**URL:** https://forum.kirupa.com/t/fmx-scrolling/34831
**Category:** flash
**Created:** [November 6, 2003, 10:20pm UTC](https://forum.kirupa.com/t/fmx-scrolling/34831 "2003-11-06T22:20:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Maizoon](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@Maizoon](https://forum.kirupa.com/u/Maizoon)
#### Post date: [November 6, 2003, 10:20pm UTC](https://forum.kirupa.com/t/fmx-scrolling/34831/1 "2003-11-06T22:20:03Z")

</div>

Hello,

I have the following script on a button:  
[AS]  
on (press, release, keyPress “\<Down\>”) {  
currentScroll = newsBox.scroll;  
if (Number(currentScroll)\<Number(newsBox.maxscroll)) {  
newsBox.scroll = Number(currentScroll)+1;  
}  
}  
[/AS]

Which quite obviously causes the text box to scroll. How can I make so if you press and hold it continues to scroll? As it stands you have to click click click to make it scroll further.

And on a side note, how would I make it scroll when you rollover (and continue to scroll as long as your mouse is over it)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 6, 2003, 11:11pm UTC](https://forum.kirupa.com/t/fmx-scrolling/34831/2 "2003-11-06T23:11:01Z")

</div>

I have a really crude way of doing this. I’m pretty new to flash; only a couple months of experience but this method works and its better than nothing. Here goes

On the timeline (not on mc) you add these functions

[AS]goDown = function () {  
if (button1 == “on”) {  
currentScroll = scrollableText.scroll;  
if (Number(currentScroll)\<Number(scrollableText.maxscroll)) {  
scrollableText.scroll = Number(currentScroll)+1;  
}  
}  
};  
goUp = function () {  
if (button1 == “on”) {  
currentScroll = scrollableText.scroll;  
if (Number(currentScroll)\>1) {  
scrollableText.scroll = currentScroll-1;  
}  
}  
};[/AS]

(in this case replace scrollableText with your instance name “newsBox”)

Now go to your buttons and add this script to the “scrolling down” button. For the scrolling up button, just change the function name to “goUp”

[AS]  
on (press) {  
button1 = "on"  
this.onEnterFrame=goDown;  
}  
on (release, releaseOutside) {  
button1 = “off”  
}  
[/AS]

that’s about it. If you want the buttons to do that when you hover over them, just change the button scripts to this i guess

[AS]  
on (rollOver) {  
button1 = “on”;  
this.onEnterFrame = goDown;  
}  
on (rollOut) {  
button1 = “off”;  
}  
[/AS]

Hope i was of some help

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 6, 2003, 11:22pm UTC](https://forum.kirupa.com/t/fmx-scrolling/34831/3 "2003-11-06T23:22:01Z")

</div>

Crude Schmood, it works…thanks 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 8, 2003, 5:05am UTC](https://forum.kirupa.com/t/fmx-scrolling/34831/4 "2003-11-08T05:05:31Z")

</div>

this works also and with a few little tweaks the scroll speed could be controlled by the user  
[AS]  
//place this in the first frame of the movie  
function scrollit(direction){  
scrollableText.scroll += direction;  
if(scrollableText.scroll\>scrollableText.maxScroll){  
scrollableText.scroll = scrollableText.maxScroll;  
} else if(scrollableText.scroll\<1){  
scrollableText.scroll = 1;  
}  
}

//place this on the scroll buttons  
on(press){  
scroller = setInterval(\_root.scrollit,100,1);//if you replace 1 with -1 it will go up  
}  
on(release, releaseOutside){  
clearInterval(scroller);  
}  
[/AS]

If you replace the 100 with a variable the speed could be dynamically changed by the user if you think that might be a usable feature  
Hope that helps, if not, I just killed about 3 mins and thats good too. 🙂  
Good Luck,  
Shawn
