|
||||||
|
||||||
Creating Buttons
Free
Flash Tutorial
![]()
The aim of the tutorial is to be able to create your own buttons. These buttons will change appearance when you roll over them. The button will change again when clicked. This is referred to as different button States. This tutorial is designed for people who have little Experience of using Flash.
Click by Click: If you would like to view this tutorial without all the notes: Click by Click
Button States
A button can change it's appearance according to what 'State' it is in. There are three states: Up, Over & Down:
Click and roll your mouse over the button below. You will see the Up, Over and Down states.
My Example: Download the Flash File Beg 005b
Click and roll your mouse over to see the different button states.Note: The button has no actions and so does not do anything.
Step One: Setting up the Document
Note: You should now be able to see a new Flash document.
Note: The document size is important as you can either have a Flash Movie which contains a number of buttons or you can have a Flash Movie that is a single button and no more:
My Example: Download the Flash File Beg 005c
A Flash Movie with several buttons. File size: 400 x130px
My Example: Download the Flash File Beg 005d
A Flash Movie which is a single button. File size: 106 x32px
Step Two: Creating the Button Symbol
A button is a type of Symbol, so the first thing to do is create a 'Button Symbol'.
Note: The "Symbols Properties" dialog box will open.
New Symbol Dialog Box.
Note: You will go to a new stage, called Button 1. In this stage, you will have four frames:
Frame 1 - Up
Frame 2 - Over
Frame 3 - Down The Button States
Frame 4 - Hit The Hit AreaButton States: The first three frames refer to the three Button States as described earlier.
Hit Area: The fourth frame enables you to set what is called a Hit Area. This will be described latter but briefly it enables you to set an area that responds when the mouse pointer passes over it or clicks in it.
Step Three: Creating the Up State
Note: If you do not return to the Selection tool you may draw more rectangles by mistake.
This should select both the fill and the stroke (outline):
Fill and stroke highlighted: Both are dotty!
You need to align your rectangle to the centre of the Stage. It is easy to do this with the Align panel.
Warning: If the both the Fill and Stroke are not highlighted you will only move part of your rectangle. Often the Stroke will get left behind, even if the stroke is white, and cannot be seen, be careful not do to do this, as this 'debris' may cause problems latter.
Align To Stage is On when the To Stage icon has a white background:
Note: Your rectangle should now be centred:
![]()
Centred rectangle has a small cross in the middle.
It is now time to make the button's text label.
Tip: Type next to the rectangle not on top of it. Otherwise if the colour of the text is set to the same colour as the rectangle's colour you will not be able to see the text!!
Typing the Button Label.
With the text still selected the panel should say:
Important: If it is not set to Static Text use the drop down menu to select: Static Text
Do not select Bold as this will be used in the Over State. My Text properties are as follows:
My Font Properties.
Note: The align To Stage' button
should still be selected.
My Button Stage.After you have finished the text label you may need to re-size your rectangle. Because the text is on top of the rectangle it may be difficult to select. If need be just move the text out of the way - you can always re-position it using the Align Panel later.

My rectangle is 105 x 31 pixels.
After you have re-sized your rectangle you may need to re-centre it with the Align Panel. You may also need to re-centre the text:
Step Four: The Over State
The Over State refers to what the button looks like when the mouse cursor is moved over the button. If the button looks different it is visually clearer to the user when the button is ready to be clicked, as they can see that the Mouse Cursor is in the correct place to click on the button. In this case I will show you how to change the Button's Font style and background color. Like this:
My Example: Download the Flash File: Beg 005a
Click and drag your mouse over this button.Note: It is not essential to have an Over State but the button will look better and be clearer to the user with an Over State.
Right Click in the Over Frame and select: Insert KeyframeNote: The Play Head will move to the Over Frame and your text and rectangle from Frame 1 is copied to the Over Frame:
The red Playhead is now in the Over Frame.
The text & rectangle are no longer selected.
Text is now too big for the background rectangle!
Reducing the text size in the Property Inspector.
You will now need to re-align the text to the centre of the Stage again:
The Over State is now done! Although we changed the font style, colour and background color you could have changed any combination of attributes.
Step Five: The Down State
The Down State is similar to the Over State in that it enables you to change the button so that it looks different when clicked. This helps the user to verify that they have actually clicked on the button.
Again you don't have to have a Down State but the button will look better and be clearer to the user if you create a Down State.
Right Click in the Down Frame and select: Insert Keyframe.Note: The Play Head will move to the Down Frame and your text and rectangle from Frame 2 is copied to the Down Frame:
The red Playhead is now in the Down Frame.
![]()
The text & rectangle are no longer selected.
Only the Text is selected.
I selected white:
![]()
Only the rectangle is selected.Tip: If the text is in the way and you cannot get past the text to select the rectangle then move the text to one side and then select your rectangle. Later you will be able to move the text back into place with the Align panel (Ctrl K).
I selected a dark blue (003366):
Step Six: Placing the Button on the Main Stage:
Note: You will return to the Main Stage, which should be empty. Don't panic you haven't lost your symbol. It's in the Library.
The button is in the Library.
Making the Button Work: Actions
For a button to do something useful you have to give it instructions. You do this through the use of ActionScript. If you need to know how to do this see the previous tutorial: Creating Links within a Flash Movie
The Hit Area
The Hit Area is an invisible the area of a Flash button that responds when the mouse pointer passes over it or clicks on it. This can be a rectangular area surrounding the button, or an irregular shape.
If you have a background shape in your button - such as a rectangle you do not need to create a hit area:
My Example: Download the Flash File: Beg 005a
No Hit Area is needed as the button has a background rectangle.
My Example: Download the Flash File: Beg 005e
The Hit Area is not in the same position as the visible button.Note: Normally the Hit Area is invisible but in the example above I have cheated and made it visible.
Important: If your button does not have a solid background (in this case a rectangle) but only text, you will have to create a rectangle (or other solid shape), in the hit area frame. Otherwise when the mouse pointer goes over the gaps between the letters, the button will go back to frame one: The over state.
Very slowly click and move the mouse over button 1 below and you will see the problem.
My Example: Download the Flash File: Beg 005f
Move your mouse slowly over the Buttons to see the difference.Button 1 is not stable and moves between states with small movements of the mouse.
Button 2 is stable. Button 2 has a rectangle in the 'Hit' frame. This is not visible in the Movie, but controls the 'Up', 'Over' and 'Down' states.
To create a Hit Area you need to edit the button and create a rectangle (or other shape) in the Hit Frame:
The red rectangle is drawn in the Hit frame inside the button and defines the Hit Area.
If you are having difficulty understanding this, download the Movie and look inside the symbol at the Hit Frame. To look inside the symbol double click it on stage.
Have fun with your buttons, make them wild and wonderful!
|
•
39416 visitors to this page since Nov 06 |
|
|
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend:
Click here
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|