5 Interactivity
Up

Without interactivity, Flash animations are just flashy eye candy, as the name suggests. However, Flash animations can allow user input via buttons, input boxes, keyboard input and more (just like Visual Basic) and once the animation is made interactive in this way then it can move beyond 'pretty' and become 'useful'.

There are two easy ways to add interactivity to your animations - adding buttons and adding keyboard input. If you decide to add buttons then you must remember that the free version of 3D Flash Animator does will disable the buttons when the movie is saved in the SWF format for inclusion in a web page, therefore you must have access to a registered (paid-for) version of the program. The free version can still provide interactivity via the use of keyboard input, however.

As a first step, we'll add buttons and keyboard input to our stick man movie, so open that movie now.

Buttons

To add an interactive button to your movie, choose Add an element>Picture Button. The button properties window will open. The picture button will not be visible in the movie until we add a picture or some text to it. A good choice would be make an oval shape and put some text inside... In the button properties window, with the normal tab of the elements section selected, choose Add and Element>Paint an image. Use the Filled Circle tool to draw an ellipse onto the movie - this will be the background of the button. Close the paint properties window and choose (still in the elements section of the button properties window) Add an Element>Title Text. Change the text size to about 25 and type the text for the button, such as 'Jump'. Your button should now look something like this:

You've noticed that its possible to set different pictures for the 'mouse over' and 'mouse down' states of the button - you can do this if you have time (do you remember the 'sheep' demo?). You don't have to set different pictures for the three states however - the normal state picture will always be used if the other states do not have pictures of their own.

You may have also noticed how easy it is to add a sound to the button so that the sound is heard when the button is clicked - just use the sound icons lower down the picture button properties window:

Of course, we want our button to do something more than just play a sound and change its appearance so in the actions section of the button down state click Add an Event. Now you can use any of the events you have learned (show, hide, morph, move, wave, explode, ping etc) to animate any object in your movie. In this exercise, we want the stick man movie to jump only when you click the button, so ... make it happen!

Keyboard Input

Adding this functionality is as easy as Add and Element>Keyboard Input. Then you will asked to choose a key to which an event (or a sequence) should be attached - this list includes the arrow keys, Escape key, Enter key etc - then simply add the event(s) that you want. Try including keyboard input in you stick man movie so that the stick man jumps each time you press the space bar.

Edit Boxes and Menus

Having studied Visual Basic, you are already aware that edit boxes (called text boxes in VB) and menus are useful ways of getting input from the user. However, I am not expecting you to have time to learn these techniques in class. If you are keen to learn them, or to earn extra credit, then why not study them at home or outside class time - don't forget that 3D Flash Animator is available as a free download over the Internet (www.insanetools.com) and the Help system gives plenty of advice about how to set up these functions.

Previous Up Next