Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 

 
Easing on Mouse Click
         by Shane Waldeck (aka lostinbeta)

Introduction
This is the second edition of tutorials on easing, if you missed the first one, it can be found HERE. This tutorial will teach you the basics of easing by moving an object to where the mouse was clicked on the stage. Other than being an important part of AS motion, it just looks cool. You can download the partial .fla file HERE, the partial .fla file does not contain any actions or key elements that make the effect work.

[ click on the movie above to see example ]

Steps to Create Animation
The following steps will help you to create the animation you see above:

  1. The first step is to create a new movie any size you would like. The example above is 300x200.
     
  2. The next step in creating this is by drawing a ball (for sake of simplicity) on the main stage and then turning it into a movie clip.
     
  3. To turn the ball into a movie clip press F8 on your keyboard then choose "Movie Clip" from the list of radio buttons. Name this movie clip "ball" (naturally...or you can name it whatever you would like).
     
  4. Well, that was pretty easy right? Now all we need to do is apply actions to this movie clip. Right click on the movie clip and choose "Actions". This will of course open up the "Actions" window.
     
  5. Apply these actions to your movie clip...

  1. Now test your movie (CTRL+Enter), pretty cool eh?
     
  2. You can download my final .fla file HERE.

Explanation of Code:

The first thing to explain is of course the onClipEvent(load) functions, so here goes nothing.  


What this does is movies your movie clip to the "x" and "y" coordinate of (0,0), this is the upper left hand corner. It also sets the speed of the effect to "5". You can of course change the speed, the lower the number, the faster the effect.

The next thing to find out what this onClipEvent(mouseDown) code is for.  


This creates an end location for your clip. When you click on the stage of your movie it will basically mark that spot for the clip to go to.

The last thing is the onClipEvent(enterFrame).  


This is a loop that takes the current (x,y) coordinates and subtracts them from the endX and endY variables (the ones your mouse creates when you click on the stage). This value gets lower and lower and is repeatedly divided by the speed. This creates a faster movement as it is farther away from the target, and a slower movement when it is closer to the target.

-Shane Waldeck (aka lostinbeta)
-www.lostinbeta.com-
 

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components Free Website | Make a Website
Streamsolutions Content Delivery Networks Learn how to advertise on kirupa.com