MINI SUPPORTERS:

 

 

 

 

 

 

 

 
Adding
A Button

Unlike regular HTML, buttons are more than just simple navigation interfaces. In Flash, any object can be a button. Buttons not only provide feasible methods of taking the user to another page, but buttons also create an interface where certain advanced functions can be called. In the tutorial below, you will learn how to create a button and add the over, down, and hit states. 

The animation below will show how your button will look at the end of this tutorial. (Move the mouse over the circle and click to see what I am talking about):

Creating And Making The Button Work:

First, create a new movie in Flash. This is fairly a simple procedure, so there will be no "intro" source code. There is the link to download the final source code on the bottom of this page as usual.

Here's How:

  1. Once you have opened a new Flash document, go to Insert > New Symbol. From the window that pops up, pick the option for Button and give it a name that will be easy to remember. Click OK. See image below:

  1. Once you have done that, you should see that your timeline has now changed to accommodate the properties of buttons. For this example, click on the Frame marked "Up", and draw a Circle in the drawing area. Also, right click on the other frames marked "Over", "Down", and "Hit" and choose Insert Keyframe. You may want to change the color of the circle for the Over and Down states so you can see that the button works. This will resemble the color changes in my example at the top of this page.
     
  2. Now, all you have to do is add the movie to your main timeline. Remember that this button was inserted as a new symbol, and must be placed in the main movie to work. Click on the Scene 1 button on the top left to be taken to the main movie. See image below:

  1. If you started this button from a new movie, your timeline and drawing area should look empty. To add the button, click on Window > Library (or Ctrl + L on keyboard) to launch the Library Window. Now all you have to do, is drag the instance "button" from the library to the timeline. Just a simple click and drag!
     
  2. Your timeline should have one and only one Keyframe on the first layer. The button should also be visible while on the screen. You can test to see how the button works by pressing Ctrl + Enter or by going to File > Publish Preview > HTML.

That is all there is to creating a button in Flash. Buttons provide interactivity as well as a fundamental way of allowing the visitor to navigate. Functions like Get URL, Go To And Play, and all the Mouse states will work only when the instance is a button. Buttons are also what the JavaScript developers call "Rollover" effects. To see how my button compares to the one you created (they should both be similar except for the color variations), download the Final source by clicking here!

Need Help?

If you have questions, need some assistance on this topic, or just want to chat - please drop by our friendly forums and post your question. There are a lot of knowledgeable and witty people who would be happy to help you out. Plus, we have a large collection of smileys you can use

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

If you didn't like it, I always like to hear how I can do better next time. Please feel free to contact me directly at kirupa[at]kirupa.com.

Cheers!

Kirupa Chinnathambi
about | facebook | twitter

 

SUPPORTERS:

cloud storage
cloud storage
kirupa.com's fast and reliable hosting provided by Media Temple. Creative web apps. Make your own free flash banners and photo slideshows.
HTML5 CSS3 Mobile Gallery for iPhone, iPad Flash effects. Art without coding.
Flipping Book - page flip flash component. Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery
X-Platform Application Development for Flash Free Flash Components Download - XML Templates, Players and Galleries.

two computer monitors

US Direct

Learn how to advertise on kirupa.com  
 
SHARE:



MINI SUPPORTERS: