|
|
BUTTONS
Weve already seen that frames can have actions assigned to them. A frame action takes place when the playback head encounters a keyframe with an action assigned to it. We can also make buttons for the user to click on, and assign actions to them! A button action takes place when the user clicks an on-screen button. Buttons are basically symbols with actions assigned to them. Buttons can be plain text, bitmap images, or vector shapes. You can use the same button over and over again, and if you want to get really fancy, you can set buttons with flashy rollover states. Buttons can be used to create interactive navigation by, among other things, instructing the playback head to jump to a different frame. Buttons can also activate movie clips, change sound, and stop the movie. Exciting, no?
Creating a ButtonCreating a button is easy. First youll need an object you can turn into a button. You can draw a button or use artwork you already have. FreeButtons.com allows you to use their stylish buttons for free! Check them out at: http://www.freebuttons.com/
After you know what you want your button to look like, follow the steps below to create it in Flash.
You just created a button! Youll notice your new symbol appears in the Library with a button icon next to it. You can use the button over and over, attaching a different action to each instance of the button.
Assigning Actions to a ButtonWhen we assigned actions to a keyframe, we selected the frame and added an action, right? When you assign an action to a button, the only difference is that instead of selecting a frame and adding an action, you select the onscreen button and add an action. Take extra special care not to double click the button when selecting it. Youll enter into editing mode.
To Assign Actions to a ButtonTo assign an action to a button, follow the below steps.
The Object Actions Palette should open.
Any action can be assigned to a button.
Creating Button Rollover StatesYou can make a rollover button in Flash. Check out ours at the web design course home. Youll do it in the button-editing mode. To enter into button editing mode, just double click any button! Button editing mode is a little different bit different than the normal symbol-editing mode in that the timeline is only four frames long.
The first frame holds a keyframe that displays the buttons "up" state, what it will look like when it first appears on the screen. The second frames keyframe will hold the buttons mouse-over state. The third keyframe will hold the "down" or clicked state. The fourth keyframe is a little different than the others. It doesnt define what the button looks like, but instead sets the buttons clickable area.
Flash rollover buttons are much less restrictive than JavaScript rollovers. Buttons do not have to be the same size in each state. Each button state can contain new or changed elements like graphics, sounds, or even movie clips!
To Add Rollover States to a Button:
You may notice that the first keyframe is filled already. Its your buttons "up" state. The up state is what the button will normally look like. You can feel free to edit the button and change its up state. Keep in mind that any editing changes you make will apply to every instance of the button used in your movie.
The cross in the middle of the button shows you the center point.
Using the Hit Frame
Flash will only recognize a rollover when the mouse is directly over an object. Thats fine, except for images like text that are hard to directly rollover. In the following text button example, Flash will recognize the line as a button, but not the white area around it.
Items in the The "Hit" Frame will never display on screen, but is instead used to define a rollover area. Anything you place on the Hit Frame will activate the buttons Over Frame when rolled over. The "Hit" Frame is optional.
1. Make sure youre in button editing mode.2. Click the "Hit" Frame in the button and add a keyframe.
In the above image, anytime a user rolls over the red area, the button will become active.
Thats it! Return to your Flash movie by clicking the Scene Button.
Buttons do not activate directly in Flash. Test your movie by hitting F12. Dont forget to attach an action to each instance of the button.
Attaching Actions to the Master ButtonYou can use the same button over and over again. Buttons retain their rollover states, but you must assign an action to the button each time you drag it onto the stage. If you want to assign an action that applies to the button every time it is used, it involves a little bit of clever trickery. Youre trying to assign an action to the button that will always apply, but Flash wont allow you to assign frame actions in the button editing stage, or youd just assign a "Go To" or "Get URL" action to the buttons Down Frame. But alas, Flash wont allow this to happen Youre to smart for Flash, though. Heres what youll do. Youre going to create a movie clip with a button inside it! That button can have an action assigned to it. Every time you drag the movie clip on the screen, itll have the button inside it!
1. Create a movie clip. 2. Double Click the movie to enter its editing mode. 3. Select the shape and change it into a button (F8) 4. Apply an action to the button. 5. Exit the movie clip editing mode. 6. Drag the movie clip onto the screen from the Library.
Volia! When a user clicks the movie clip, theyll also be clicking the button, sending your user off to happy navigation land.
Controlling Movie Clips with ButtonsYou can control any movie clip with buttons. You can make any movie clip stop, play, or jump to a specific frame of the movie clips time line. In this way, you can use movie clips to create interactivity without using the timeline. Naming Movie ClipsRemember that you can drag the same movie clip from the library multiple times. When targeting a command at a movie clip youll probably only want to aim an action at one specific instance of the clip. If we name our movie clip instances as we drag them onto the screen well be able to refer to each one individually. That way we could have the same movie clip on the screen a number of times, but we could control which ever one we wanted.Youll need to name each instance of a
movie clip on the screen so you can target it individually.
|