First time here? First time here? Newsletter Signup Newsletter
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: S.Saipriya
» Title: Flash Fire Effect
» Description: This tutorial explains about how to create Fire Effect in Flash of Actionscript 2.0.I hope this tutorial helps you!
Featured Sound Loops
Image for equalize

Audio Player

» Author: Aidan Crouzet-Pascal
» Title: Falling Star
» Description: This loop is a cool sounding, E minor loop.
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: Brandan Paulin
» Description: Epic sounding loop with Brass, Percussion, Strings and Winds. This is actually part of a Loop Pack called the Coming where you can download the rest of the loops that go with it FREE from my website.