First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: Vera Fleischer | Website: http://www.mediasparkles.com
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 <%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
(10 being the highest)
» 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.
» Forums
More help? Search our boards for quick answers!

Comments

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

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.