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)
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]
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