ptg From the Library of Lee Bogdanoff ptg TRY IT YOURSELF ▼ When you’re ready to roll up your sleeves and get some hands-on experience, look for one of the more than 90 “Try It Yourself” mini-lessons that provide step-by-step walkthroughs of key Flash tasks and techniques. HOUR 1: Basics . Make an Animation in 30 Seconds 8 . Change Your View on the Stage 12 . Use the Properties Panel to Inspect and Change Fill Colors 18 HOUR 2: Drawing and Painting Original Art in Flash . Use the View Tools to Help You See 37 . Draw and Change Lines 40 . Paint Fills 44 . Draw and Modify Shapes 47 . Fill the Stage with the Deco Tool 48 . Use the Pen Tool 50 . Create and Style Text 51 . Use the Selection Tool to Select and Modify Shapes 57 . Select Attributes with the Dropper Tool 60 . Transform Drawn Objects 62 . Use Snap to Objects to Draw Perfect Shapes and Connect Objects 65 HOUR 3: Importing Graphics into Flash . Import a Raster Graphic 77 HOUR 4: Staying Organized with the Library and Layers . Create a Symbol by Converting Selected Objects 90 . Create a New Symbol from Scratch 93 . Transform the Location, Scale, and Rotation of Instances 101 . Change Color Styles on Several Instances 103 . Make a Symbol by Using Instances of Another Symbol 108 HOUR 5: Controlling Color . Create a Custom Color and Swatch 119 . Create a Custom Gradient 122 . Transform Attributes of Gradients Used in a Movie 123 HOUR 6: Applied Layout Techniques . Display the Time in Dynamic Text 133 . Use the Hard Light or Overlay Blend to Add a Highlight 135 . Combine Techniques to Improve the Bevel Filter 137 HOUR 7: Understanding Animation . Analyze a Finished Animation 150 HOUR 8: Using Motion Tweens to Animate . Create a Basic Motion Tween 157 . Tween Position, Scale, Rotation, and Color 161 . Make an Animation Finish Where It Starts 165 . Make an Animation Ease In and Ease Out 170 HOUR 9: Using Shape Tweens to Morph . Make a Simple Shape Tween 178 . Use Shape Hints for a Better Shape Tween 183 HOUR 10: Advanced Animation with Inverse Kinematics . Create a Shape and Add Bones with the Bone Tool 192 . Create a Shape from Multiple Movie Clips and Add Bones 194 . Animate a Figure by Adding Poses 197 . Control the Motion of an Armature with the Bind Tool 198 HOUR 11: Simulating 3D Animation . Create a 3D Movie Clip 207 . Use the 3D Translation Tool to Create an Animation 210 . Create Multiple Rotating Movie Clips 210 HOUR 12: Reusing Your Animations with Motion Presets . Apply an Existing Motion Preset 217 . Modify and Save an Existing Preset 220 . Change the Easing of an Existing Preset 223, 225 HOUR 13: Including Sound in Animations . Import a Sound 231 . Add Sounds and Sound Effects to an Animation 240 HOUR 14: Nesting Animations in Movie Clip and Graphic Symbols . Use a Movie Clip to Make a Rotating Wheel 254 . Compare a Movie Clip Symbol to a Graphic Symbol 258 HOUR 15: Creating Special Effects . Use an Imported Bitmap as a Fill Color in a Hall of Mirrors 268 . Animate a Block of Text, One Character at a Time 269 . Convert Text to a Shape for Special Effects 270 . Splatter Animated Movie Clips 272 . Add a Shadow to Show Depth and Distance 275 . Add a Filter with the Motion Editor 277 . Use Masking to Create a Spotlight Effect 278 . Create a Hand-Drawn Masking Transition 280 . Use a Mask as a Stencil 281 HOUR 16: Basic Interactivity . Make an Action That Loops Part of Your Movie 291 . Use a Frame Label as the Destination of a gotoAndPlay Action 293 . Make a Simple Button 296 . Add Buttons to an Animation to Stop and Continue Playback 299 . Make a Simple Portfolio Viewer 305 HOUR 17: Introducing Components . Manually Populate the ComboBox Component 314 . Populate the ComboBox Component by Using ActionScript 316 . Create Multiple Buttons for a Portfolio317 . Use the RadioButton Components 320 . Apply the Radio Buttons 321 HOUR 18: Using Components . Use the List Component to Enable Users to Select Images 333 . Use the ProgressBar Component as a Preloader 338 . Use the Slider to Access Frames in a Movie Clip 339 HOUR 19: Using Video . Embed a Video 349 . Make a Playback Controller for an Embedded Video 353 . Create an .flv and Use the FLVPlayback Component 355 . Rotoscope (Draw Frames of a Video) 357 . Inject and Use Cue Points 359 . Animate a Video in 3D 363 HOUR 20: Linking a Movie to the Web . Publish a Movie 371 . Use navigateToURL to Create a Hyperlink 374 . Create a Text Hyperlink 376 . Use Dynamic Text to Create a Hyperlink 377 . Display Text by Using CSS 379 HOUR 21: Designing a Website to be Modular . Load a Movie 392 . Use the Loader Class to Display Progress 395 . Play an External MP3 398 . Load Text from File 399 HOUR 22: Minimizing File Size . Use the Bandwidth Profiler to Judge Download Times 415 . Reduce a File’s Size with the Bandwidth Profiler’s Help 419 . Use a Preloader in the Bandwidth Profiler 421 HOUR 23: Optimizing Performance . Use a Custom Performance Meter to Calculate Frame Rate 428 HOUR 24: Publishing a Creation . Set Up the Publish Settings and Then Publish a Movie 435 . Address Users Without Flash 440 . Customize a Template 441 . Add Metadata for Search Engine Optimization 443 . Add XMP Data to a Movie 445 From the Library of Lee Bogdanoff ptg 800 East 96th Street, Indianapolis, Indiana, 46240 USA Phillip Kerman and Lynn Beighley 24 in Hours Sams TeachYourself Adobe ® Flash ® CS4 Professional From the Library of Lee Bogdanoff ptg Sams Teach Yourself Adobe Flash CS4 Professional in 24 Hours Copyright © 2009 by Sams Publishing All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or other- wise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsi- bility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. ISBN-13: 978-0-672-33041-4 ISBN-10: 0-672-33041-5 Library of Congress Cataloging-in-Publication Data: Kerman, Phillip. Sams teach yourself Adobe Flash CS4 professional in 24 hours / Phillip Kerman and Lynn Beighley. 1st ed. p. cm. ISBN 978-0-672-33041-4 (pbk.) 1. Flash (Computer file) 2. Multimedia systems. 3. Web sites Design. I. Beighley, Lynn. II. Title. QA76.575.K4625 2009 006.7'8—dc22 2009015798 Printed in the United States of America First Printing May 2009 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an “as is” basis. The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of programs accompanying it. Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact U.S. Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales international@pearsoned.com Acquisitions Editor Mark Taber Development Editor Songlin Qiu Managing Editor Patrick Kanouse Project Editor Seth Kerney Copy Editor Jovana San Nicolas- Shirley Indexer Tim Wright Proofreader Matt Purcell Technical Editor Brandon Houston Publishing Coordinator Vanessa Evans Cover Designer Gary Adair Compositor Mark Shirar From the Library of Lee Bogdanoff ptg Introduction 1 What’s New in This Edition 2 Who Should Read This Book 3 How This Book Is Organized 3 What’s on the Book’s Website 4 Part I: Assembling the Graphics You’ll Animate in Flash HOUR 1: Basics 7 Jump Right In and Make an Animation 7 Getting Your Bearings 9 Getting Around in Flash 23 Document Properties 28 File Types 29 HOUR 2: Drawing and Painting Original Art in Flash 35 Drawing on the Stage 36 Tools 36 Selecting and Transforming Objects 54 HOUR 3: Importing Graphics into Flash 69 Vector Graphics Versus Raster Graphics 69 Reasons to Avoid Importing Graphics 70 Importing Vector Graphics 71 Using Bitmaps (Also Known as Raster Graphics) 75 HOUR 4: Staying Organized with the Library and Layers 89 The Concept of the Library 89 Using the Library 96 Using Symbols from the Library 100 HOUR 5: Controlling Color 113 Using Blends and Filters 113 Creating and Saving Color Swatches 118 HOUR 6: Applied Layout Techniques 129 Setting Text 129 Applied Examples Using Color Styles, Blends, and Filters 134 Part II: Animating in Flash HOUR 7: Understanding Animation 143 How Animation Works 143 Elements of Animation 144 HOUR 8: Using Motion Tweens to Animate 157 Creating a Motion Tween 157 Fine-Tuning a Motion Tween 165 HOUR 9: Using Shape Tweens to Morph 177 Making a Shape Tween 177 Refining and Fine-Tuning a Shape Tween 182 HOUR 10: Advanced Animation with Inverse Kinematics 191 Linking Symbols with the Bone Tool 191 Animating the Armature 195 HOUR 11: Simulating 3D Animation 203 Creating a 3D Movie Clip 203 Moving Objects with the 3D Translation Tool 209 Rotating Objects with the 3D Rotation Tool 210 HOUR 12: Reusing Your Animations with Motion Presets 215 The Motion Presets Panel 215 Applying an Existing Motion Preset 217 Editing an Existing Preset with the Motion Editor Panel 222 HOUR 13: Including Sound in Animations 229 Importing Sounds 229 Using Sounds 232 Controlling Quality and File Size 241 Contents From the Library of Lee Bogdanoff ptg HOUR 14: Nesting Animations in Movie Clip and Graphic Symbols 253 Movie Clip Symbol Behavior 253 Subtleties of Movie Clips 260 HOUR 15: Creating Special Effects 267 Effects with Shapes 267 Splatter Movie Clips with the Spray Brush Tool 272 Using Filters for Special Effects 274 Masking Effects 277 Part III: Adding Interactivity and Video HOUR 16: Basic Interactivity 287 Basic ActionScript 287 Making Simple Buttons 295 Listening for Events 299 HOUR 17: Introducing Components 313 What Is a Component? 313 Using the Button Component 317 Using the RadioButton Component 319 Changing Component Appearances 322 HOUR 18: Using Components 329 Using Data Providers 329 Working with Other Components 337 HOUR 19: Using Video 345 Embedding Video Versus Playing External Video 345 Using Video 352 3D Animation with Video 363 Part IV: Putting It All Together for the Web HOUR 20: Linking a Movie to the Web 369 Basic Publishing 369 Simple Hyperlinks 373 Using Style Sheets 378 What Other Web Tasks Can Flash Do? 380 Using Flash Inside a Larger Website 382 Uploading Files to a Web Server 386 HOUR 21: Designing a Website to Be Modular 391 Loading Movies or Images 391 Determining When a Movie Is Fully Loaded 395 Playing External Sounds 398 Loading External Text 399 HOUR 22: Minimizing File Size 405 File Size Considerations 405 HOUR 23: Optimizing Performance 427 Measuring Performance 427 Impacts on Performance 428 HOUR 24: Publishing a Creation 435 How to Publish 435 Adding Metadata to Your Flash Creation 443 Choosing Which Version to Publish 445 Deciding Which Media Types to Publish 446 Exporting Other Media Types 455 Index 459 Sams Teach Yourself Adobe® Flash® CS4 Professional in 24 Hours iv From the Library of Lee Bogdanoff ptg About the Authors Phillip Kerman is an independent programmer, teacher, and writer, who specializes in the Adobe Flash platform. He has trained and made presentations around the world, in such exotic locations as Reykjavik, Iceland; Melbourne, Australia; Amsterdam, Holland; and McAlester, Oklahoma. He has programmed several games on MSN and Messenger Live, including Sudoku Too and Jigsaw Too, as well as the real-time cattle auction site stampedecattle.com. Phillip is also the author of Macromedia Flash @work, Flash MX 2004 for Rich Internet Applications, and ActionScripting in Flash MX from New Riders Publishing. Lynn Beighley is a freelance author, web designer, and web developer. After going back to school to get a Masters in Computer Science, she worked for the acronyms NRL and LANL. Then, she discovered Flash and wrote her first bestseller. A victim of bad timing, she moved to Silicon Valley just before the great crash. She spent several years working for Yahoo! and writing other books and training courses. Upon discovering that technical book writing actually paid real money, she learned to accept and enjoy it. Finally giving in to her creative writing bent, she moved to the New York area to get an MFA in creative writing. She current- ly creates Flash animations and applications that range from the ridiculous to the sublime. From the Library of Lee Bogdanoff ptg Acknowledgments CS4 Edition The creation of this book could not have happened without the skill and patience of many, many people at Sams Publishing. Most of all, I want to thank Mark Taber for offering me this opportunity and Philip Kerman for writing such a great book. I also greatly appreciate the efforts of Songlin Qiu for keeping me on track and organized, not an easy task. Other folks I’d like to thank include Seth Kerney, Brandon Houston, and Jovana San Nicolas-Shirley. Finally, thank you Adobe for keeping Flash the great product that it is and taking it in inter- esting new directions. Keep up the awesome work! —Lynn Beighley CS3 Edition Most successful feats involve the efforts of many people. This book is no exception. I’m proud of the result, but I can’t take full credit. Here is my attempt to acknowledge everyone. First, I’d like to thank the people at Sams Publishing. When Randi Roger approached me, not only did she provide the faith that I could write this book, but she also stressed the sup- port I would receive from Sams Publishing. She wasn’t exaggerating. The following people were professional and prompted me every step of the way: Betsy Brown, Lynn Baus, Brandon Houston, Jeff Schultz, Amy Patton, Carol Bowers, Mark Taber, Kate Small, Matt Purcell, Vanessa Evans, and Damon Jordan (who as Development Editor made this book flow), plus all the editors listed in the front of this book. When you look at other Sams books, you’ll see many of these people acknowledged for a reason—they are great! There are countless correspondents with whom I’ve learned a lot about Flash. Instead of naming several and inadvertently neglecting many, let me just say that participating in local user groups and online forums is a great way to expand your knowledge and build your business—they’ve helped me and helped this book. Of all the places I’ve learned about Flash, being in the classroom and teaching has probably been the most educational for me. The students and staff of the Northwest Academy, Pacific Northwest College of Art and Portland Community College deserve special recognition. —Phillip Kerman From the Library of Lee Bogdanoff ptg We Want to Hear from You! As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass our way. You can email or write me directly to let me know what you did or didn’t like about this book—as well as what we can do to make our books stronger. Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message. When you write, please be sure to include this book’s title and author as well as your name and phone or email address. I will carefully review your comments and share them with the author and editors who worked on the book. Email: graphics@samspublishing.com Mail: Mark Taber Associate Publisher Sams Publishing 800 East 96th Street Indianapolis, IN 46240 USA Reader Services Visit our website and register this book at informit.com/register for convenient access to any updates, downloads, or errata that might be available for this book. From the Library of Lee Bogdanoff ptg This page intentionally left blank From the Library of Lee Bogdanoff [...]... covered in depth in Hour 2, “Drawing and Painting Original Art in Flash.” The Timeline contains the sequence of images that make an animation The Timeline can also include multiple layers, so certain graphics can appear above or below others, and you can have several animations playing simultaneously The Timeline is introduced in Hour 7, “Understanding Animation.” Panels stay out of the way by collapsing... look better Part II: Animating in Flash This is where you start moving things! You learn everything from 3D animation to tweening to Inverse Kinematics with the Bone tool You also learn about valuable time-saving tools, like the Motion Preset Library and the Motion Editor Part III: Adding Interactivity and Video In this part of the book, you take a big step into writing instructions so your Flash...Introduction Adobe is not exaggerating when it says that Flash CS4 Professional is the “industry-leading authoring environment for creating engaging interactive experiences.” You only need to visit a few sites that use Flash to understand how compelling it is Using graphics, animation, sound, and interactivity, Flash can excite, teach, entertain, and provide practical information With... these tools If you think you lost the Tools panel, you can restore it by clicking Window, Tools Selection tools Creating tools Modifying tools View tools Colors Options area FIGURE 1.7 The Tools panel has tools for drawing, editing, and viewing, plus options that vary, depending on the currently selected tool The Timeline You look at the Timeline in depth when you start animating in Hour 7, “but let’s... you are at all times If you think you’re in the Library, editing the contents of a symbol, for example, you have a problem if you are in fact editing something on the main timeline It can be confusing because although it’s always possible to figure out where you are in Flash, you can easily get lost The following sections look at how you can determine where you are in the interface The Current Layer... you to change your view of the Stage (as you did in the preceding task) The colors setting gives you control over the color of objects drawn Finally, the options area includes additional modifiers for certain tools Depending on what tool is selected, you might not see anything in the options section You look at these tools in detail in the next few hours (in particular, Hour 2 and Hour 6, “Applied Layout... can see what the finished project looks like and investigate how it was built We’ve also included media files, such as images, audio, and video, necessary to complete a few of the tasks From the Library of Lee Bogdanoff PART I Assembling the Graphics You’ll Animate in Flash HOUR 1 Basics HOUR 2 Drawing and Painting Original Art in Flash HOUR 3 Importing Graphics into Flash HOUR 4 Staying Organized with... worth investing the time to read 24 hour-long chapters If you learn by doing, this is a good book for you If you’re looking for any of the following Flash topics, they’re not covered here: writing class files in ActionScript 2.0 or ActionScript 3.0, developing content for mobile phones, using Flex Builder, building true 3D environments in Flash (although we do cover the new 3D tool), integrating with... Getting Around in Flash 25 The Edit Bar often includes more information than is shown in Figure 1.15 When you learn more about the Library in Hour 4, you see how you can nest instances of symbols inside other symbols When you double-click a complex object, such as a symbol to edit it, everything else on the Stage dims, indicating that those other items are not editable (This behavior of going inside... developers all delivering Flash content The CS4 upgrade is offers a few new tools, techniques, and further integrates with other Adobe CS4 products This edition doesn’t try to cover everything; there simply isn’t time to do that in 24 one-hour lessons Instead, we focus on animation techniques, graphics, and delivering to the web You also spend a whole hour exploring new features including video with the . 28 File Types 29 HOUR 2: Drawing and Painting Original Art in Flash 35 Drawing on the Stage 36 Tools 36 Selecting and Transforming Objects 54 HOUR 3: Importing Graphics into Flash 69 Vector Graphics. Version to Publish 445 Deciding Which Media Types to Publish 446 Exporting Other Media Types 455 Index 459 Sams Teach Yourself Adobe® Flash® CS4 Professional in 24 Hours iv From the Library. making entertaining movies. Imagine a great musician picking up and learning an instrument in a matter of days. It really is that amazing. If you’re moti- vated, with just a moderate time investment,