|
|
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:
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 > 1) {
scrollIt();
}
checkIfPressed = setInterval(callBack, 500);
}
down_arrow.onPress = function() {
pressed = 1;
if (w_field.scroll < 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?
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|