Intro to Flash | 4
|
|
Working with Flash
Adding Advanced Features
While our example could stand alone and go right into the rest of the site, we can also add buttons for user controls. Let's add a button that will play the animation again. We will need another frame at the end of what we've already got. Click on the red box by the 25 on the Timeline and go to Insert> Frame (or press the F5 key). Now we can create a new layer and a button. This is just like creating the other symbols we have, except that we will use the button behavior instead of graphic. Go to frame 26 and insert a keyframe in the new layer. Now draw a rectangle box and type "replay" over it. Once you have this lined up so it looks nice, select both the text and the box and convert them to a button symbol. For reference, this is done using Insert> Convert to Symbol and then select the button behavior in the box that pops up.
To make our button change when the mouse is over it, open the Library Window if it is not already showing and double click on the button we just made. In the Timeline area, you will now see the four states of a button: up, over, down, hit. Add a keyframe to the over state. Now click on the button and adjust the scaling (in the Inspectors> Transform tab) so that it gets smaller. When you are done editing the button, click on the Scene 1 tab in the top left corner of the Timeline area to get back to the regular working space. Now we need to make our button do something.

Fig. 6 - The replay button
To add functionality to our button, we edit the actions associated with it. To do this, double click on the button in the work area. Under the Actions tab, click on the plus sign and then select Go to. On the right side of this window you will see the options that go along with this command. For our example, we want to set the Frame to 1 and make sure the box at the bottom for "Go to and Play" is checked. Now our button will return the movie to the beginning where our animations will start again.
Although it is not necessary in this example, if the button wasn't at the end of the movie and controled when the animations would start, we would need to add a stop action to the frame. To do this, click on the frame containing the button and go to Modify> Frame. Here you will find the same Actions tab that we saw before, but this time select Stop. It is common for Flash animations to have start buttons at the beginning. In a case like that, we would need the Stop action so the animation would not play until the user had clicked.

Fig. 7 - Making our "continue" button
In the same way that we added the "replay" button, let's make a "continue" button. This way the user could decide if they wanted to watch the animation again or just go to the heart of the Web site. The process for this is the same as for the "replay" button, we can even make this button on the same layer and frame. Create the text saying "continue" and place it where you want it in the work area. Then convert it to a symbol with button behaviors. Double click on the text to get into the Actions tab. Add the Get URL action this time and then fill in the options on the right as needed. And there you go!
So we've got a fancy Flash movie created, but how do we get it on the Web?
Next: Publishing Flash files and the final product
Comments are welcome
Written by Kate Levy and
Revised: June 23, 2000
URL: http://webreference.com/multimedia/flash/flash4.html

Find a programming school near you