Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here










 

Google

Search WWW   
FlashAdvisor.com

 Home > Tutorials  > Beginners

Create Simple Button and ading Action Script

Author: FlashAdvisor | Email


Advertisement

The
first step in this process is actually creating the button.
You may already know

how to do this, but many Flash developers forget a step
or two here and there, and end up with buttons that don't
always work properly.

- Make a new movie to work in (File | New from the menu
or Ctrl + N)

- Create a new Symbol (Insert | New Symbol from the menu
or Ctrl + F8).

- A Symbol Properties dialog will pop up. Name the button
whatever you

want, set its Behavior to "Button" and press
OK.






The symbol editing window will open 4 frame : Up, Over, Down,
and Hit. Draw the initial state of the

button in the Up state. The button can be pretty much
anything you could imagine.





Insert a keyframe in the Over state. This is the frame
that will appear when the button is moused over. If you'd
like the button to do something interesting on mouse over,
this is where you make it happen.

- Insert a keyframe in the Down state. This is the frame
that appears when the button is pressed. If you don't
want the button to change at all when it is hit, you can
just insert a frame here instead of a keyframe.

- Insert a keyframe in the Hit state. This frame defines
the effective hit area of

the button. If you are using only text as the example
demonstrates, this is

particularly important, as without a Hit state the effective
hit area is defined

by the text itself - which can make it very hard to actually
hit the button!

Simply draw a shape to define the hit area in this frame.
It doesn't matter

what it looks like, since this state is never actually
seen by the user



Adding an Action to the Button


A
common mistake that many beginners make is to add the
button actions in the

states of the button symbol itself. This is often the
reason why those buttons just

don't work. You must add your action to the instance
of the symbol as outlined

below:

- Select the button that you want to add an action to.
Open the Instance Properties dialog for that instance
of the button by either double-clicking on the button
or selecting Modify | Instance from the menu (or by
pressing Ctrl + I).

- Select the Actions tab in the Instance Properties
dialog.

- For this example we will add the action Play to the
button.

- Press the + button in the Actions dialog.

- Scroll down to Play.

- Press OK.

Press Ctrl+Enter or F12 to publish the movie and test
the buttona




Download Source File

| 1 |

Rate This Tutorial :
We hope the information helped you. If you have any questions or comments, please don't hesitate to post them on the Forums section
Submit your Tutorial at Click Here
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

1 user online