marq

Dr. Charles Simonyi is the Father of Modern Microsoft Excel                                           JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, later LiveScript, and finally renamed to JavaScript.                                           The word "Biology" is firstly used by Lamarck and Treviranus                                           Hippocrates (460-370 bc) is known as father of medicine.                                           Galene, 130-200 is known as father of Experimental Physology                                           Aristotle (384-322 BC) is known as Father of Zoology because he wrote the construction and behavior of different animals in his book "Historia animalium"                                           Theophrastus(370-285 BC) is known as father of Botany because he wrote about 500 different plants in his book "Historia Plantarum".                                           John Resig is known as Father of Jquery -                                          HTML is a markup language which is use to design web pages. It was invented in 1990 by Tim Berners-Lee.                                                                The Google was founded by Larry Page and Sergey Brin.                                                                Rasmus Lerdorf was the original creator of PHP. It was first released in 1995.                                                               Facebook was founded by Mark Zuckerberg                                                               Bjarne Stroustrup, creator of C++.                                                                Dennis Ritchie creator of C                                                                                                                              James Gosling, also known as the "Father of Java"                                          At 11.44%, Bihar is India's fastest growing state                                          Father of HTML -Tim Berners Lee                                          orkut was created by Orkut Büyükkökten, a Turkish software engineer                    Photoshop: It came about after Thomas Knoll, a PhD student at the University of Michigan created a program to display grayscale images on a monochrome monitor which at the time was called 'Display'.

Complex Button RollOver/RollOut Effects





It seems everywhere you look now has some form of complex button. Most buttons that have an animation when rolled over and an animation when you roll out are done with some form of this concept that I intend to share with you.
If you understand basic Flash concepts and just a smidgen of Actionscript, you will catch on in no time.
Before we get started, take a look at what will be created. It may not look like much, but from this one simple concept, sites like " The Life Aquatic" movie site are possible.
[ an example of what you will create ]
Here is How
  1. Create a new Flash document.
  2. Open up the document properties by pressing ctrl+j (cmd+j on Mac) and change the stage size to 100x100. Change the Frame Rate to 30.
  3. Rename layer 1 on the main timeline to complexButton. The main timeline should now look like this:
  1. Create a new movieclip by pressing ctrl+F8 (cmd+F8 on Mac). Name it mc_complex.
  2. Double click mc_complex in the library to edit the symbol. Select the Oval Tool(o) and make a 30x30 circle on the stage. In the properties panel set the x and y values for that circle to 0.
  3. Double click the circle to select the Fill and Stroke. Press F8 to convert it to a symbol so we can tween it. Make it into a graphic symbol and name it gr_circle:
  1. Still editing the mc_complex movieclip select frame 15 and press F6. This inserts a keyframe. Resize the circle a little bigger than what is there. I went with 40x40.
  2. Right click on any frame between the two keyframes on the timeline and select Create Motion Tween.
  3. Create a new layer and call it actions. Insert a blank keyframe(F7) on frame 15. The timeline for mc_complex should now look like this:
  1. Select the first frame of the actions layer. Type this code in the actions panel:

//stop();
 
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}
}
 
this.onRollOver = function(){
rewind = false;
play();
}

 

this.onRollOut = function(){

rewind = true;
}
 
this.onRelease = function(){
getURL("http://www.kirupa.com","_blank");
}

  1. Select frame 15 of the actions layer, Type this code in the actions panel

stop();
  1. Navigate back to the root timeline. Put an instance of mc_complex from the library onto the stage.
  2. Save the flash document and test your movie(ctrl + enter). There you have it, a button that animates on rollover and on rollout.
Now lets look at the code:

stop();
 
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}

}

The first stop command just stops the movieclip from playing (so the animation doesnt loop). What the onEnterFrame event handler is doing is checking to see if rewind is set to true. If it is, the animation plays backwards until it reaches a stop.

this.onRollOver = function(){
rewind = false;
play();
}

The onRollOver event handler does two things, it sets rewind to false so that the onEnterFrame event handler doesn't execute the prevFrame script. The other thing the onRollOver does is play the animation. So when you roll over the button, rewind gets set to false, then the animation plays and you see the button grow until the playhead hits the stop command on frame 15.

this.onRollOut = function(){
rewind = true;
}

 

this.onRelease = function(){

getURL("http://www.kirupa.com","_blank");
}

This last chunk of code is rather simple. When you roll out of the button, rewind gets set to true. So now the onEnterFrame will execute the prevFrame (becuase rewind is equal to true) until it reaches a stop. The onRelease event is where you place your code for when the button is clicked.
Download FLA
If you have any questions, please post them in the forums: kirupaForum
Warhero
 



No comments:

Post a Comment