Search tutorials
The scroll buttons
Go back inside your main movie clip.
For the arrow buttons, I just used the ones from the scrollbar component available in Flash MX and changed the colors a little bit. Feel free to design your own cool button(s). However, they should be the same width as the scroll track. Place them on the scroll track and line them up at top and bottom. Their instance names should be "up_arrow" and "down_arrow". The buttons should only be present on the second and third frames of the main mc.
The first frame of the functions layer is our designated functions frame. We won't put functions on any other frames in this movie clip. Right now we'll add the functions that scroll the text field when an arrow button is clicked:
Publish your movie and click the arrows - it works!
Also, to ensure that the text field keeps scrolling when an arrow is held down continuously, add this to the second frame above the play() action:
Go back inside your main movie clip.
For the arrow buttons, I just used the ones from the scrollbar component available in Flash MX and changed the colors a little bit. Feel free to design your own cool button(s). However, they should be the same width as the scroll track. Place them on the scroll track and line them up at top and bottom. Their instance names should be "up_arrow" and "down_arrow". The buttons should only be present on the second and third frames of the main mc.
The first frame of the functions layer is our designated functions frame. We won't put functions on any other frames in this movie clip. Right now we'll add the functions that scroll the text field when an arrow button is clicked:
function scrollIt() {
w_field.scroll += pressed;
}
function stopScroll() {
still_pressed = false;
pressed = false;
}
function callBack() {
if (pressed) {
still_pressed = true;
} else {
still_pressed = false;
}
clearInterval(checkIfPressed);
}
up_arrow.onPress = function() {
pressed = -1;
if (w_field.scroll <%gt%> 1) {
scrollIt();
}
checkIfPressed = setInterval(callBack, 500);
}
down_arrow.onPress = function() {
pressed = 1;
if (w_field.scroll <%lt%> w_field.maxscroll) {
scrollIt();
}
checkIfPressed = setInterval(callBack, 500);
}
up_arrow.onRelease = down_arrow.onRelease = up_arrow.onReleaseOutside = down_array.onReleaseOutside = stopScroll;
Publish your movie and click the arrows - it works!
Also, to ensure that the text field keeps scrolling when an arrow is held down continuously, add this to the second frame above the play() action:
if (still_pressed) {
scrollIt();
}
Next we'll add the scroll thumb. Ready?| » Level Advanced |
|
Added: 2002-03-23 Rating: 7 Votes: 116 |
| » Author |
| I have been flashing for almost two years, first at an online learning company and now at a university. My dream is to one day work for Macromedia as an ActionScript Engineer! |
| » Download |
| Download the files used in this tutorial. |
| Download (68 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!