Electric Type

Multimedia

About Us

News

Help

Advanced Flash
Lesson 2

by Michael Kay

Page 5 — Buttoning Up

For the purposes of this example, we'll keep it simple. Justcreate a button that looks good enough to click on - a plain shape thatchanges colors in the Over state will do. If you need a refresher onhow to build a button object in Flash, go back and review the introductory tutorial.

Once you are satisfied with your button, return to the Edit Movie mode(Command-E for a Macintosh or Control-E on Windows allows you to togglebetween the Edit Symbols and Edit Movie modes). Now let's add the button tothe movie window.

Name the first layer Soundtrack button. With the Library tool paletteopen (Window:Library), select the name of the button you just created anddrag the preview of that button to the stage in order to position the symbol. Createa second layer above the first and label it Soundtrack. Select the Soundtrack symbol fromthe Library tool palette and drag it into position so that the word "Play"is layered over the button.

With everything in place, all that's left is to wire it up (i.e.,assign the actions). Double-click on just the word "Play" and you'll getthe instance properties for the Soundtrack symbol. Make sure theDefinition tab is selected. This symbol needs an Instance name in orderfor the Tell Target actions to work. It also must be set to Movie Clipbehavior. Name this instance my_music. Click OK.

Instance Properties

Next, access the Instance Properties of the Soundtrack button symbol. Select theAction tab. Click on the "+" icon and add a Tell Target action. You'llnotice that Flash conveniently inserts an On MouseEvent action for you. Ifyou've selected "Begin Tell Target," you'll see a dialog box to the rightlabeled "Target." There also should be a representation above of your movieclip instance. Double-click on the my_music icon and Flash will fill inthe box for you. Next, we Tell our Target what to do. Just add a play action below whereit says "Begin Tell Target." Remember the stop actions we assigned to eachkeyframe of the Soundtrack symbol? This play action will tell the targetsymbol to play, but the Stop actions will allow it to advance only oneframe. Got it? Click OK.

Make sure that the Soundtrack and Soundtrack button layers appearwherever you want the users to control the playing of the sound -while this isn't strictly necessary for this particular example, it is amust for more complex Flash movies.

Still with us? Good, because your patience is about to pay off. SelectCommand-Return (Control-Enter for Windows) to preview the results. Ifyou've done everything right, you should see the Play button. Go ahead andclick on it, if you haven't already. The music should start as the buttonchanges to "Stop."

Using this Tell Target action, you can also replace the sounds andgraphics to create different effects from the same structure. Instead of"Stop" and "Play," you could give users a choice of soundtracks. Or evenreplace the sounds with graphics.

The key thing to remember when designing your Flash animations is thatnot all your buttons need to behave in a typical "button-y" fashion.Clicking on a picture of a flower could trigger a sound or send theflower into motion. Don't forget that you can assign an action to anygraphic symbol. After it's placed in the movie, select the Buttonbehavior under the Instance Properties dialog box. This will reveal theActions palette for that instance of the symbol. By using this strategy,and by combining multiple Tell Target actions, you can create some reallyfun interaction.

Once you get the hang of Tell Target actions, try creating more complexsetups like these. But don't exhaust yourself - there's more Tell Targetwork to be done in this lesson.

next page»


Tutorials  

User Blogs  

Teaching Tools  

Authoring  

Design  

Programming help  

Advanced Flash  

Javascript  

Glossary  

PHP Coding  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.