First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: Aaron Ham

Now this is where the fun begins.

Creating the code

Well, you should now have a nice line of Icons that do absolutely nothing (unless you assigned an action to the buttons). They just sit there and look like any other menu on the block. Well, it's time to give it some identity and make it move.

Open the object actions for the control movie clip.

The first section of code will set up some functions for us to use later. We only need these functions to be defined once, so I used the "onClipEvent (load)" action. Two functions are defined here - checkOffset(coffset) and setScale(soffset).

The first function checks to see if the offset value passed to it is outside our acceptable range. If it is, then it sets the offset to the maximum or minimum value. Basically, it keeps the offset between -175 and +175 pixels. So what is the offset for? The offset is the distance between the origin point of the icon and the cursor.

The second function setScale(soffset) will return the scale value of the icon in question based on the offset value. The closer the cursor gets to the icon in question, the larger the icon will grow, up to a maximum of 300%. The farther away the cursor becomes, the smaller the icon will get, to a minimum of 100%.

onClipEvent (load) {
	function checkOffset (coffset) {
		if (coffset<-175) {
			coffset = -175;
		} else if (coffset>175) {
			coffset = 175;
		}
		return coffset;
	}
	function setScale (soffset) {
		return 100*(3-(2*(Math.abs(soffset)/175)));
	}
}
» Level Intermediate

Added: 2002-02-19
Rating: 7.99 Votes: 186
(10 being the highest)
» Author
I'm a freelance web developer and designer. Although I specialize in networking (you know, Cisco routers, servers, etc), I also dabble with programming and right-brained creativity.
» 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.