• Understand everything Flash is—vector-based animator, video engine, multimedia authoring program, desktop app developer, and more • Master the Flash interface, tools, symbols, and th
Trang 1Feel the full effects of Flash
Adobe Flash is getting flashier with each release, and
the new Flash Professional CS5 comes with a slew of
new enhancements Find out what’s new, what’s better,
and how you can get the most out of everything Flash
has to offer with this in-depth guide Apply cool visual
effects, create interfaces with ActionScript®, add animation,
program faster with drop-in code snippets—it’s all here
and more from top industry Flash trainer, Todd Perkins.
• Understand everything Flash is—vector-based animator, video
engine, multimedia authoring program, desktop app developer,
and more
• Master the Flash interface, tools, symbols, and the Library
• Integrate Flash content with Web pages
• Use Flash movies with JavaScript® and DHTML
• Create animation, use the Motion Editor, and integrate media files
• Create and publish AIR® applications
Find source fi les and examples to company the lessons in the book, as well as templates you can use for your
ac-own projects The CD also includes:
• Trial software and shareware
• Add-ons and plug-ins
System Requirements: Please see
Appendix A in the book for details and complete system requirements
Trang 3Flash Professional
CS5 Bible
Trang 5Flash Professional
CS5 Bible
Todd Perkins
Trang 6Wiley Publishing, Inc.
111 River St.
Hoboken, NJ 07030-5774
www.wiley.com
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana
Library of Congress Control Number: 2010929311
ISBN: 978-0-470-60228-7
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA
01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO
REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE
CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT
LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE NO WARRANTY MAY BE CREATED
OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINED
HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION THIS WORK IS SOLD WITH THE UNDERSTANDING
THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL
SERVICES IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL
PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR
DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN
THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN
THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE
MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE FURTHER, READERS SHOULD BE AWARE THAT
INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN
THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer
Care Department within the U.S at 877-762-2974, outside the U.S at 317-572-3993 or fax 317-572-4002.
Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in
electronic books.
Trademarks: Wiley, the Wiley logo, and related trade dress are trademarks or registered trademarks of John Wiley &
Sons, Inc and/or its affiliates, in the United States and other countries, and may not be used without written permission
Adobe and Flash are registered trademarks of Adobe Systems Incorporated in the United States and/or other countries All
other trademarks are property of their respective owners Wiley Publishing, Inc is not associated with any product or
vendor mentioned in this book.
Trang 7As a lifelong fan of animation, Todd’s childhood dream was to become a cartoonist In 2000, Todd had an opportunity to create his first Web site, and at the time, Flash was a popular tool for doing
so He quickly fell in love with Flash, and a few years later got a job as a Flash designer at a graphic design company After gaining real-world experience using Flash to develop Web sites, Todd decided to become a Flash consultant, using his skills to help others master Flash Since then,
Todd has written several books, including Flash CS3 Hands on Training, ActionScript 3.0 in Flash CS3 Hands on Training, Nintendo Wii Flash Game Creator’s Guide, and Search Engine Optimization for Flash He has also recorded a vast array of video titles about Flash and ActionScript for Lynda.com, including Flash CS5 Essential Training, ActionScript 3.0 in Flash CS4 for Designers, Object Oriented Programming in ActionScript 3.0, and several others Todd also speaks at conferences, trains in class-
rooms, and has taught Flash to employees in several major organizations including Disney, Boeing,
and Los Angeles Times Todd also loves to create Flash applications and games, and has created
Web sites and apps for clients, such as Chris Orwig and Douglas Kirkland
When Todd is not teaching Flash or creating Flash applications, he enjoys playing video games, and spending quality time with his wife and son in southern California
Trang 8Quality Control Technicians
Laura AlbertRebecca Denoncour
Trang 9Ito generate compact, vector-based graphics and animations for delivery over the Web With Macromedia’s embrace, Flash blossomed In 2005, Adobe Systems, Inc acquired Macromedia and,
in three short years, has successfully integrated Flash into their family of powerhouse graphics, video, and design software Not only has the Flash platform obtained ubiquity, but Flash content
is now more easily created across a wide range of professional software applications The Flash Player plug-in ships with most major browsers and operating systems Flash graphics appear not only all over the Web, but also on television and movie screens, on phones, on kiosks, and even in art galleries
As the Web-surfing public and the development community have continued to demand more of Flash, Adobe has delivered After Creative Suite 3 was released, Adobe went out into the world and sat with people using its programs to see what they used, what they needed, and how the next gen-eration of Creative Suite tools could support daily workflow and specialize tasks more effectively
The result is a release that promotes expressiveness and enhances efficiency while encouraging best practices in development — a functional and an inspiring combination that has earned rave reviews from visual designers and code-oriented developers at all levels
The Flash CS5 Professional interface is consistent with other Creative Suite 5 (CS5) products; it has tool options and other editing features contained in streamlined panels and lots of important changes to the authoring environment The Mac interface is nearly 100 percent identical to the Windows interface, with support for docked panels, tabbed panels, and enhancements to the cod-ing environments in Flash CS5 and Dreamweaver CS5
Flash movies can communicate directly with server-side scripts and programs, using standard URL-encoded variables, XML-formatted structures, Web services, or powerhouse data transfers from Flash Remoting–enabled servers Sounds can be imported and exported as MP3 audio for high-quality music on the Web at the smallest file sizes Flash Player 10 supports nearly every Web file format you’ll ever come across Loading of JPEG, PNG, GIF, MP3, FLV, AAC, and H.264 video content streamlines production and maintenance of dynamic high-volume media sites The updated FLVPlayback component and the addition of custom tools, custom effects, and behaviors offer Flash users of all skill levels some exciting possibilities Evidence of the dominance of the Flash format can be found in the wide range of third-party developers creating applications that output to the Flash movie format (.swf files) Flash has fulfilled its promise of becoming the central application for generating interactive content for delivery on the Web; the potential only seems to expand as more developers tap into the data-handling power of Flash and its increasingly sophisti-cated graphics capabilities as it continues to grow beyond the computer screen
Trang 10Is there any other Flash book for you?
Adobe Flash CS5 Professional Bible is the most comprehensive and exhaustive reference on Flash
It helps you get started on your first day with the program and will still be a valuable resource when you’ve attained mastery of the program When you’re looking for clues on how to integrate Flash with other programs so that you can deliver unique and compelling content in the Flash for-mat, you’ll know where to turn We’ve put significant effort into this edition, updating all ActionScript content to use ActionScript 3.0, the most recent version of the ActionScript language available in Flash Player 9 or higher
Flash is not just a single tool You can think of Flash as a multitasking application It’s an tion program, an image/sound/video editor, an animation machine, and a scripting engine, all rolled into one In this book, we look at each of these uses of Flash and explain how all the features work together
illustra-To address advanced scripting topics and more server-side development issues, Roger Braunstein,
Mims Wright, Josh Noble, and Joey Lott have written the ActionScript 3 Bible (Wiley, 2007) to
fully address advanced use of the ActionScript 3.0 scripting language If you’re already adept at creating animation and basic interactive interfaces in Flash and you want to expand your knowl-edge of more complex coding techniques, you may want to compare the table of contents in this
book with that of ActionScript Bible to determine which book covers the topics you’re most
inter-ested in
How to Get the Most Out of This Book
Here are some things to know so you can get the most out of this book:
First, to indicate that you need to select a command from a menu, the menu and command are separated by an arrow symbol For example, if we tell you to select the default workspace layout from the Flash application menu, the instructions will say to choose Window ➪ Workspace ➪ Essentials
Parts I and II of the book are entirely dedicated to project planning and getting familiar with the Flash interface Parts III and IV explain how to generate animation and integrate other media files into your Flash movies Parts V through VIIgradually introduce you to the power of ActionScript and show you how to take advantage of Flash components to quickly create dynamic applications that support live data Although this book was written to take a beginner by the hand, starting from page one, you can also use it as a reference Use the index and the table of contents to find what you’re looking for, and just go there, or jump in anywhere If you already know Flash and want to get some details on sound, for example, just go to any of the chapters in Part IV,
“Integrating Media Files with Flash.”
This is a real-world production book: We’ve worked hard to ensure that our lessons, examples, and explanations are based on professional conventions The CD-ROM that accompanies this book
Trang 12contains many of the source Flash project files (.fla), with original artwork and ActionScript for the examples and lessons in the book You can also find sample video files to encode with Flash video!
Icons: What Do They Mean?
Although the icons are pretty standard and self-explanatory (they have their names written on them!), here’s a brief explanation of what they are and what they mean
Tip
Tips offer you extra information that further explains a given topic or technique, often suggesting alternatives
or workarounds to a listed procedure n
Note
Notes provide supplementary information to the text, shedding light on background processes or miscellaneous
options that aren’t crucial to the basic understanding of the material n
Caution
When you see the Caution icon, make sure you’re following along closely to the tips and techniques being
dis-cussed Some external applications may not work exactly the same with Flash on different operating systems
and some workflows have inherent risks or drawbacks n
This icon indicates that the CD-ROM contains a related file and points you to the folder location n
How This Book Is Organized
This book has been written in a format that gives you access to need-to-know information very easily in every section (or part) of the book If you are completely new to Flash, then you’ll want to read Parts I through VI After you have developed a familiarity with the Flash interface and the new
Trang 13drawing and effects tools, you can proceed to Parts VII and VII We’ve included step-by-step descriptions of real Flash projects to help you “leap” from the intro topics to the advanced topics
These sections of the book guide you through the production process, helping you apply ActionScript and production techniques that may be new to you
If you’ve already used Flash, then you may want to review the changes to the Flash CS5 interface
in Part I, and then jump right into other specific parts to learn more about animation, ActionScript, creating artwork and content in other applications, integrating Flash with HTML, and using Flash
to publish iPhone applications There are many new features and workflow enhancements for new and experienced users alike in every section of the book, so even if you’ve done a lot of work in Flash, it’s worth scanning each part for an introduction to new tools and techniques
Part I: An Introduction to Flash Web Production
The first part of this book explores the Flash file format and how Flash CS5 fits into the evolution
of the program (Chapter 1), explains the context in which Flash movies interact on the Web (Chapter 2), and gives an overview of multimedia planning and some specific techniques and suggestions that will make your Flash project development less painful and more productive (Chapter 3)
Part II: Mastering the Flash Environment
This part gives you all the information you need to feel comfortable in the Flash CS5 authoring environment Get an introduction to, and some tips for, customizing the Flash UI (Chapter 4)
Learn where to find your drawing tools and how to use them efficiently (Chapter 5), and then cover all the ways that Flash helps you to organize and optimize project assets (Chapter 6) Learn key color concepts relevant to multimedia production and find out why Flash has the best color tools yet (Chapter 7) Jump into using text-editing tools and see how to get the best-looking type and the smallest file sizes in your Flash projects (Chapter 8) Finally, learn how to modify text and graphics to get the most out of your Flash artwork (Chapter 9)
dis-Part III: Creating Animation and Effects
After you’ve learned how to find your way around the Flash interface and how to create static graphics, you can learn to make things move and how to work with different symbol types to opti-mize your animation workflow (Chapter 10) Then, add polish and pizzazz with Flash filter effects and blend modes (Chapter 11)
Trang 14Part IV: Integrating Media Files with Flash
Now that you’re fluent in the Flash workspace, take your projects to the next level by adding sound, special graphics, and video assets In Chapter 12, you learn the basics of digital sound, and how to import, optimize, and export high-quality sound for different types of projects Chapter 13 gives you an overview of how to bring vector or raster artwork from other programs into Flash and how to protect image quality while optimizing your Flash movies Chapter 14 introduces the excit-ing video features of Flash CS5 and the new Adobe Media Encoder CS5 application, including the use of the high-quality AVC/H.264 video codec and adding ActionScript cue points without writ-ing ActionScript code
Part V: Adding Basic Interactivity
Part VI: Distributing Flash Movies
You need to learn how to export (or publish) your Flash presentations to the swf file format for use in an HTML document, or within presentations in other formats Chapter 18 details options in the Flash CS5 Publish settings, and provides tips for optimizing your Flash movies in order to achieve smaller file sizes for faster download performance If you prefer to hand-code your HTML, read Chapter19, which describes how to use the <embed> and <object> tags and how to create plug-in detection systems for your Flash movies using the SWFObject JavaScript library If you want to find out how to create a Flash stand-alone projector, or use the Flash stand-alone player, check out Chapter 20 Learn how to publish cross-platform applications using Adobe AIR in Chapter 21 In Chapter 22, use Flash to create iPhone applications and learn how to get those apps
on your iPhone and in the App Store
Getting in Touch
Check Appendix B to learn more about this book’s various contributors and guest experts, ing URLs of their work and contact information for people who don’t mind being contacted directly by our readers
Trang 15includ-For quality concerns or issues with the CD-ROM, you can call the Wiley Customer Care phone number: (877) 762-2974 Outside the United States, call 1 (317) 572-3994, or contact Wiley Customer Service by e-mail at techsupdum@wiley.com Wiley Publishing, Inc will provide technical support only for CD-ROM installation and other general quality-control items; for techni-cal support on the applications themselves, consult the program’s vendor.
Adobe Wants to Help You
Adobe has created a Feature Request and Bug Report form to make it easier to process suggestions and requests from Flash users If you have an idea or feature request for the next version or you find a bug that prevents you from doing your work, let the folks at Adobe know You can find the online form at www.adobe.com/support/email/wishform
The simple fact is this: If more users request a specific feature or improvement, it’s more likely that Adobe will implement it
Regardless of your geographic location, you always have access to the global Flash community for support and the latest information through the Adobe online forums at www.adobe.com/
cfusion/webforums/forum/index.cfm?forumid=15.For inspiration and motivation check out the Site of the Day, weekly features, and case studies at
www.adobe.com/showcase
Trang 16Tthere is also a good deal of content from dedicated contributors that has been carried over from the previous edition We are always grateful for the added breadth and depth the tutorials from our guest experts bring to the content First and foremost, we would like to thank the Flash development community In our combined experiences in research and multimedia production,
we haven’t seen another community that has been so open, friendly, and willing to share advanced tips and techniques It has been gratifying to be involved as the community keeps expanding and
to see the innovators in the first wave of Flash development become mentors to a whole new eration Thank you all for continuing to inspire and challenge audiences and each other with the possibilities for Flash
gen-I would like to thank everyone at Wiley Publishing who supported us as we researched and
revised, week after week A Flash Bible production team can’t steer itself — our gratitude goes to
Aaron Black, the acquisitions editor, and Beth Taylor, the project editor Zachary Szukala, the technical editor, was instrumental in helping me keep our material honest and effective
Of course, this book about Flash wouldn’t even exist without the hard work of the people at Adobe who make it all possible Many thanks to the developers, engineers, and support staff at Adobe, especially Jay Armstrong, for answering so many of my questions I am also indebted, as always, to all our intrepid fellow developers and authors, who helped us to get our bearings in early versions
of Flash CS5
Trang 17Acknowledgments xiii
Part I: An Introduction to Flash Web Production 1
Chapter 1: Understanding the Adobe Flash CS5 Blueprint 3
Chapter 2: Exploring Web Technologies 17
Chapter 3: Planning Flash Projects 33
Part II: Mastering the Flash Environment 61
Chapter 4: Interface Fundamentals 63
Chapter 5: Drawing in Flash 113
Chapter 6: Symbols, Instances, and the Library 185
Chapter 7: Applying Color 233
Chapter 8: Working with Text 263
Chapter 9: Modifying Graphics 305
Part III: Creating Animation and Effects 357
Chapter 10: Timeline Animation and the Motion Editor 359
Chapter 11: Applying Filters, Blends, Guides, and Masks 429
Part IV: Integrating Media Files with Flash 473
Chapter 12: Adding Sound 475
Chapter 13: Importing Artwork 513
Chapter 14: Displaying Video 557
Part V: Adding Basic Interactivity to Flash Movies 599
Chapter 15: Understanding Actions and Event Handlers 601
Chapter 16: Building Timelines and Interactions 627
Chapter 17: Making Your First Flash CS5 Project 641
Trang 18Chapter 19: Integrating Flash Content with Web Pages 707
Chapter 20: Using the Flash Player and Projector 739
Chapter 21: Creating Adobe AIR Applications Using Flash CS5 753
Chapter 22: Using Flash to Create iPhone Applications 769
Part VII: Appendixes 785
Appendix A: Using the CD-ROM 787
Appendix B: Guest Experts’ Information 791
Appendix C: Digital Audio Basics 793
Appendix D: Digital Video Basics 801
Index 811
Trang 20Acknowledgments . . . xiii
Part I: An Introduction to Flash Web Production 1 Chapter 1: Understanding the Adobe Flash CS5 Blueprint . . .3
The Key Is Integration 4
The topography of Flash CS5 6
File types in Flash CS5 7
The Many Worlds of Flash CS5 12
Bitmap handler 12
Vector-based drawing program 13
Vector-based animator 13
Video engine 13
Audio player 14
Multimedia authoring program 14
Animation sequencer 14
Programming and database front end 15
Desktop application authoring program 16
iPhone application development program 16
Summary 16
Chapter 2: Exploring Web Technologies . . . 17
Contextualizing Flash in the Internet Evolution 17
High expectations for Web experiences 17
To Flash or not to Flash? 20
Alternative methods of multimedia authoring 24
Exploring Companion Technologies 27
HTML is here to stay 27
Client-side scripting using JavaScript 28
The world of Web services 28
Adobe server technologies 29
Trang 21Recognizing Project Potential 29
Linear presentations 29
Interactive presentations 30
Data-driven presentations 30
Data-driven applications (or Rich Internet Applications) 30
Summary 31
Chapter 3: Planning Flash Projects . . 33
Workflow Basics 33
Phase I: Establishing the concept and goals 34
Phase II: Producing, testing, and staging the presentation 46
Using the Project Panel in Flash CS5 49
1 Establishing a project structure 50
2 Creating the project in Flash CS5 51
3 Changing project and panel preferences 54
4 Opening and editing files in the project 57
5 Publishing the entire project 58
Summary 59
Part II: Mastering the Flash Environment 61 Chapter 4: Interface Fundamentals. . . 63
Getting Started 63
Welcome to Flash CS5 64
Start Page 64
Help menu options 66
The Flash CS5 interface on Macintosh and Windows 67
What to expect from the Properties panel 69
Managing Windows and Panels 71
Contextual menus 71
Floating and docking panels 72
Focus: Making panels or windows active 73
Creating custom workspace layouts 73
Keyboard shortcuts 74
The Tools Panel 76
Controlling the Tools panel 76
Reading the Tools panel 77
Using Tool options 78
Customizing the Tools panel 78
The Document Window 82
Controlling the Document window 83
Reading the Document window 85
Using scenes 86
Using Document window menu options 88
Working with Flash templates 91
Trang 22The Timeline Window 92Controlling the Timeline window 92Using the Timeline Controller toolbar 93Reading the Timeline 93Editing frames and layers 99Using Frame View options 108Printing 111Summary 112
Chapter 5: Drawing in Flash . . . 113
Using Geometric Shape Tools 114The Oval tool 115The Oval Primitive tool 116The Rectangle tool and Rectangle Primitive tool 118Join and Miter settings 119The PolyStar tool 120The Line tool 122Using Drawing Tools 123The Pencil tool 123The Brush tool 125The Eraser tool 130Creating Precise Lines and Bezier Curves with the Pen Tool 132Using Fill and Stroke Controls 137Choosing colors 137Choosing line styles 139Controlling stroke Scale behavior 143Optimizing Drawings 145Putting Selection Tools to Work 146The Selection tool 147The Lasso tool 154The Subselection tool 156Designing and Aligning Elements 159Simplifying snapping settings 159Design panels 164The Edit Menu 170Creating Patterns with Symbols Using the Spray Brush Tool and the Deco Tool 172Applying random “ink” with the Spray Brush tool 173Creating order and pattern with the Deco tool 176Summary 183
Chapter 6: Symbols, Instances, and the Library . . . 185
Understanding the Document Library 186Working with Common Libraries and External Libraries 187Working with multiple Document Libraries 189Reading the Library panel 191Organizing Library panels 195
Trang 23Defining Content Types 196Raw data 196Drawing objects and shape primitives 197Groups 197Native symbols 198Imported media elements 200Editing Symbols 202Modifying a symbol in Edit mode 202Editing a symbol in a new window 203Editing a symbol in place 203Editing symbols from the Library 203Returning to the Main Timeline or scene 203Modifying Instance Properties 205Applying basic color effects to symbol instances 206Changing the symbol type of an instance 207Swapping symbols 208Building Nested Symbol Structures 208Converting a raw shape into a Graphic symbol 209Using Graphic symbols in a button 210Animating Graphic symbols in a Movie Clip 212Adding a Movie Clip to a Button symbol 214Modifying a MovieClip instance 2159-Slice Scaling for Movie Clip Backgrounds 218Using the Movie Explorer 222Filtering buttons 223The display list 223The Movie Explorer Options menu 224The contextual menu 225Using Authortime Shared Libraries 226Summary 231
Chapter 7: Applying Color . . . 233
Introducing Color Basics 233Discussing Web-safe color issues 234Using hexadecimal values 235Using color effectively 236Working in the Swatches Panel 240Swatches panel options 242Importing custom palettes 244Using the Color Panel 248Adjusting fill and stroke transparency 251Working with gradient fills 252Controlling gradient fill colors 254Using alpha settings with gradients 256Selecting bitmap fills 259
Trang 24Working with Droppers, Paint Buckets, and Ink Bottles 261Summary 261
Chapter 8: Working with Text . . 263
Considering Typography 264Text Field Types in Flash 264Editable text fields 268The Text Tool and the Properties Panel 269Working with the Text tool 269Setting text attributes in the Properties panel 273Controlling flow between multiple text fields 281Font Export and Display 283Smoothing text with anti-alias settings 283Understanding device fonts 285Working with the Use Device Fonts setting 286Troubleshooting font display 287Controlling font substitution 287Font Symbols and Shared Font Libraries 289Creating a font symbol 290Updating font symbols at authortime 293Using font symbols in runtime shared libraries 294Modifying Text 300Editing text manually 300Moving beyond the box with live filter effects 302Summary 304
Chapter 9: Modifying Graphics . . . 305
Sampling and Switching Fills and Strokes 306The Eyedropper tool 306The Ink Bottle tool 308The Paint Bucket tool 309Using the Paint Bucket Gap size option 311Using the Paint Bucket Lock Fill option 312Transforming Gradients and Bitmap Fills 313Adjusting the center point with the Gradient Transform tool 314Rotating a fill with the Gradient Transform tool 315Adjusting scale with the Gradient Transform tool 316Setting gradient fill overflow styles 316Skewing a bitmap fill with the Gradient Transform tool 318Gradient Transform Used for Lighting Effects 318Applying Modify Shape Menu Commands 320Convert Lines to Fills 320Creating scalable artwork 320Expand Fill 321Soften Fill Edges 322
Trang 25Free Transform Commands and Options 325The Transform panel 326The Modify Transform menu 326The Free Transform tool 326Transforming shapes, symbols, text, and groups 327Manipulating Symbols in 3D Space 329Controlling the camera view: Perspective and vanishing point 331Transforming symbols with the 3D Rotation tool 332Moving symbols with the 3D Translation tool 336Modifying Item Types 337Stacking order 337Grouping 338Applying Break apart 339About the Magic Wand option 343Tracing bitmaps 344Working with Drawing Objects and Combine Object Commands 346Working with Compound Shapes 348Editing with Find and Replace 350Using the History Panel 352Replay Steps 353Copy Steps 354Clear History 354History View 354Save As Command 354Summary 355
Chapter 10: Timeline Animation and the Motion Editor . . . 359
Basic Methods of Flash Animation 359Frame-by-Frame Animation 360Adding keyframes 362Creating frame-by-frame animation 363Modifying Multiframe Sequences 364Onion skinning 366Editing multiple frames 366Using Tweens for Animation 369Shape tweening 370Adding shape hints 374Motion tweening 378Modifying motion tween properties 382Working with motion tween spans and layers 384Editing motion paths 387
Trang 26Adding control to animation along a motion path 389Working with motion presets 390Adjusting Easing and Tween Properties with the Motion Editor 392Controlling property views in the Motion Editor 395Editing tween curves and property key frames 395Eases and custom eases 396Animating 3-D properties 398Integrating Multiple Animation Sequences 403Moving tweens onto symbol timelines 404Organizing symbol instances on the Main Timeline 407Reusing and Modifying Tweened Symbol Instances 410Creating IK Armatures with the Bone Tool and Bind Tool 413Adding Spring to IK animations 419Animating shapes with IK 422Runtime bitmap caching 425Bitmaps 425Make Flash work for you 426Summary 426
Chapter 11: Applying Filters, Blends, Guides, and Masks . . 429
Applying Filters in Flash 429Adding and adjusting filters 430Creating dimensional shadows 434Combining filters and saving custom presets 435Animating filters with motion tweens 438Using the Motion Editor to control filter interpolation 439Controlling Color: Properties versus Filters 441Adjust Color filter 442Color properties 444Using advanced color effects: Understanding relative and absolute color settings 445Layering Graphics with Blend Modes 448Understanding blend modes 448Applying basic blends 451Applying compound blend modes: Alpha and Erase 452Creating an animated Alpha blend 453Working with Special Layer Types: Guides and Masks 455Using guide layers 456Adding masks 458Masking with a filled shape 460Masking with a group 463Masking with a symbol instance 463Masking text 464Using Distribute to Layers 468Summary 471
Trang 27Part IV: Integrating Media Files with Flash 473
Chapter 12: Adding Sound . . 475
Identifying Sound File Import and Export Formats 476Import formats 476Export formats 477Importing Sounds into Flash 480Assigning a Sound to a Button 482Adding Sound to the Timeline 485Organizing Sounds on the Timeline 486Enhanced viewing of sound layers 486Organizing sound layers with a layer folder 487Synchronizing Audio to Animations 487Event 487Start 488Stop 488Stream 488Stopping Sounds 489Stopping an event sound 489Stopping a single instance of a stream sound 492Stopping all sounds 492Editing Audio in Flash 494Sound-editing controls 494Applying effects from the Effect menu of the Properties panel 495Sound Optimization Overview 497Publish Settings for Audio 498The Set options 499Supporting audio and MP3 playback 502Fine-Tuning Sound Settings in the Library 503Settings for audio in the library 503Combining methods for controlling sounds 505Final Sound Advice and Pointers 505VBR (Variable Bit Rate) MP3 506Optimizing sounds for bandwidth usage 507Extracting a sound from a Flash document 509Summary 511
Chapter 13: Importing Artwork . . . 513
Defining Vectors and Bitmaps 513Knowing the File Formats for Import to Flash 516Preparing Bitmaps 519Preserving Bitmap Quality 521
Trang 28Importing and Copying Bitmaps 522Importing sequences 524Working with layered bitmap files 524Copying and pasting a bitmap into Flash 530Applying color effects, alpha, and filters to bitmaps 530Setting Bitmap Properties 531Being prepared for common problems 534Cross-browser consistency 535Using the Bitmap Buttons in the Properties Panel 535Swap 535Edit 536Making Sense of Bitmap Compression 53724-bit or 32-bit lossless source files 5378-bit lossless source files 538Source files with lossy compression 539Converting Rasters to Vectors 540Using External Vector Graphics 542Importing Vector Artwork 543Copying and pasting a vector image into Flash 545Importing Adobe Illustrator files 546Optimizing Vectors 549Interpreting complex vector artwork 550Converting text to outlines 550Optimizing curves 552Runtime bitmap caching 552Working with XFL: The New Flash Format 554Summary 555
Chapter 14: Displaying Video . . 557
Integrating Video: The Solutions 558Loading a Flash Video file at runtime 558Real-time streaming a Flash Video file at runtime 558Embedding video into a Flash movie 559Importing the Video 559
An overview of codec options 560Compressing video with Adobe Media Encoder CS5 562Using the Video Import wizard 569Deploying video files with Flash CS5 573Working with the Component parameters 579Using FLVPlayback Custom UI components 581Adding Cue Points 585Working with Video Alpha Channels 594Live action footage 595Summary 598
Trang 29Part V: Adding Basic Interactivity to Flash Movies 599
Chapter 15: Understanding Actions and Event Handlers . . . 601
Actions and Event Handlers 601What is ActionScript? 603Navigating the Actions panel 603
A brief primer on code syntax 606Your First Five Actions 608gotoAndPlay() and gotoAndStop() 609nextFrame() and prevFrame() 610nextScene() and prevScene() 611play() and stop() 611navigateToURL() 612Making Actions Happen with Event Handlers 615Using the Code Snippets panel 615Combining an action with an event handler to make a functioning button 616The Flash event handlers 618Creating Invisible Buttons and Using navigateToURL 620Summary 626
Chapter 16: Building Timelines and Interactions . . . 627
A Brief History of Movie Clips: The Key to Self-Contained Playback 627How Movie Clips interact within a Flash movie 628One movie, several timelines 629Targets and Paths Explained 631Absolute paths 633Relative paths 634Targeting Movie Clips in Flash CS5 635Summary 640
Chapter 17: Making Your First Flash CS5 Project . . . 641
The Main Timeline As the Site Layout 641Creating a plan 643Setting up a local folder structure 643Determining Flash movie properties 644Mapping presentation areas to keyframes 644Creating content for each area 646Adding Navigation Elements to the Main Timeline 652Creating text buttons for a menu 652Browsing the video items 657Text Scrolling with the TextArea Component 659Using the Custom BlurFader Component 663Making the Movie Accessible 665Summary 669
Trang 30Part VI: Distributing Flash Movies 671
Chapter 18: Publishing Flash Movies . . . 673
Testing Flash Movies 673Using the Test Scene or Test Movie command 674Using the Bandwidth Profiler 676Using the size report 681Publishing Your Flash Movies 682Publish Settings 682Selecting formats 682Using the Flash settings 684Using the HTML settings 689Using the GIF settings 696Using the JPEG settings 699Using the PNG settings 701Creating Windows and Mac projectors 703Publish Preview and Publish Commands 703Using Publish Preview 703Using Publish 703Using Publish Profiles 704Summary 706
Chapter 19: Integrating Flash Content with Web Pages . . . 707
Writing Markup for Flash Movies 707Using the <object> tag 708Using the <embed> tag 715Detecting the Flash Player 717Plug-in versus ActiveX: Forcing content without a check 718Detecting the Flash Player with Flash CS5 719Detecting the Flash Player with SWFObject 725Using Flash Movies with JavaScript and DHTML 729
A word of caution to Web developers 729Understanding how Flash movies work with JavaScript 729Changing HTML attributes 730Adding a percentLoaded() method 733Summary 738
Chapter 20: Using the Flash Player and Projector . . 739
Using the Stand-Alone Flash Player and Projector 739Creating a projector 740Distribution and licensing 742Distribution on CD-ROM or DVD-ROM 742Stand-Alone Limitations and Solutions 743
Trang 31Using the Flash Player Plug-In for Web Browsers 743Supported operating systems 744Supported browsers 744Plug-in and Flash movie distribution on the Web 744Plug-in installation 745Using the Settings in Flash Player 6 and Later 746Privacy 746Local Storage 747Microphone 748Camera 748Player Utilities 749Summary 751
Chapter 21: Creating Adobe AIR Applications Using Flash CS5 . . . 753
Understanding Adobe AIR 753Learning security differences between standard Flash Player and AIR 753Creating a simple AIR application 754Understanding additional AIR APIs 762Publishing and Sharing AIR Applications 763Preparing to publish an AIR app 763Publishing an AIR application 765Distributing an AIR Application 767Summary 767
Chapter 22: Using Flash to Create iPhone Applications . . . 769
Understanding Flash on the iPhone 770Learning how it works 770Differences when working with Flash for iPhone development 770Preparing to Develop iPhone Apps 772Joining the Developer Program 772Obtaining your device’s ID 773Requesting a development certificate 773Downloading your development certificate 774Creating a provisioning profile for your device 774Creating a p12 version of your certificate 774Creating an application identifier 775Publishing a IPA file from Flash 775Using a default loading image 776Getting the IPA file on your iPhone 776Building a Flash iPhone Application 776Understanding performance in Flash iPhone applications 781Summary 783
Trang 32Part VII: Appendixes 785
Appendix A: Using the CD-ROM . . . 787
Reviewing Example swf and fla Files 788Installing and Using Plug-Ins and Applications 789Source Files and Applications 789Troubleshooting 789Customer Care 790
Appendix B: Guest Experts’ Information . . . 791 Appendix C: Digital Audio Basics . . 793
Understanding the Basics of Sampling and Quality 793What is sound? 794What affects the quality and size of sound files? 794Getting Tips on Production 799
Appendix D: Digital Video Basics . . 801
Garbage In, Garbage Out: Controlling Video Quality 802Source format 802Image quality 804Sound quality 805Subject matter 806Editing Footage 808Choosing an Import Format 808
Index . . . 811
Trang 34If you’re new to Flash or to multimedia production, this
section gets you started on the right foot If you are a veteran Flash user, this section gives you some per-spective on the evolution of Flash and the workflow
options available in Adobe Flash CS5
Chapter 1 provides a comprehensive overview of the
strengths and weaknesses of the Flash format and some
background on where Flash came from and how it has
evolved Chapter 2 explores the various ways that Flash
movies interact with other Web formats and introduces
some of the issues that need to be considered when
plan-ning for specific audiences Chapter 3 has expanded
cover-age of strategies for multimedia project planning, including
descriptions of how to create flowcharts, site maps, and
functional specification documents
Trang 36IN THIS CHAPTER
Exploring the uses of Flash CS5 Identifying Flash file types Introducing the structure of Flash documents
Understanding the
Adobe Flash CS5
Blueprint
Since its humble beginnings as FutureSplash in 1997, the Flash
author-ing tool and the Flash platform have matured into a powerful tool for
deploying a wide range of media content With every new version
released, the possibilities have increased for imaginative and dynamic
con-tent creation — for the Web and beyond After Adobe acquired Macromedia
in 2005, Adobe has expanded Flash capabilities in several Creative Suite
products, as well as development tools such as Adobe Flex Builder The
Adobe user interface is consistent across powerhouse applications such as
Adobe Photoshop, Adobe Flash, and Adobe Illustrator
In this chapter, I introduce Flash CS5 and explore the many possibilities
available for your productions I also discuss how Flash compares to or
enhances other programs that you may be familiar with
Flash content can be viewed in a few different ways The most common
method is from within a Web browser, either as an asset within an HTML
page or as a Web site completely comprised of a master Flash movie using
several smaller Flash movies as loaded SWF assets The Flash Player is also
available as a stand-alone application (known as a projector), which can be
used to view movies without needing a Web browser or the plug-in This
method is commonly used for deployment of Flash movies on CD-ROMs,
floppy disks, or other offline media formats With Adobe AIR, Flash content
can be installed into computers as native desktop applications Finally, with
Flash CS5, content made in Flash can be published as iPhone and iPod
touch applications, and released in Apple’s App Store
Cross-Reference
You can learn more about projectors and stand-alones in Chapter 22, “Using
the Flash Player and Projector.” n
Trang 37The Key Is Integration
Flash has seen significant development over its 12 years in both capability and design Consistently with each new release, designers and developers push the technology into new territory In its current iteration, Flash CS5 enables you to create content that’s compatible with Adobe Flash Player 10, one
of the largest updates to the Flash Player There are two sides of the integration coin: designing the user interface and high-end programming with ActionScript 3.0 Flash CS5 continues to satisfy both designers and programmers — all the new authortime visual effects in Flash CS5 and Flash Player 10 are fully programmable with ActionScript, the programming language of Flash
Flash CS5 Professional, also referred to simply as Flash CS5, adds several enhancements to ous editions:
previ-l Adobe document import and export: Because Adobe oversees the development of
Photoshop, Illustrator, and Flash, it’s much easier to coordinate file format interoperability between the applications You have more options than ever to faithfully bring Photoshop, Illustrator, and After Effects content into Flash documents Many of the CS5 tools can now export XFL (XML-based FLA) files and FXG (an XML-based image format) files that enable a smooth workflow from tools such as Illustrator and After Effects into Flash
l Improved animation and drawing features: Adding realistic physics is now easier using
the new Spring feature with IK animations The Spring feature adds automatic “follow through” to IK animations for a more lifelike effect
l Improved text: If you have ever wanted text that rendered from right to left, like many
Asian languages, you now have that feature in Flash with the new Text Layout Framework (TLF) This feature adds support for new languages, multicolumn text, and right-to-left text Flash CS5 also comes with a larger and more intuitive font embedding menu
l Code snippets: Since the introduction of ActionScript 3.0, Flash programming has had a
steep learning curve, especially for those who are entirely new to programming In Flash CS5, there are many built-in snippets of code that you can apply to objects you create to add complex interactivity without having to write a line of code
l Video features: In previous versions of Flash, adding cue points to video was something
that could only be done either before the video was encoded or by using ActionScript In Flash CS5, you can add cue points quickly and easily through the Properties panel Flash CS5 also allows you to preview video in the Flash environment, without having to test your movie in the Flash Player
Tip
If you’re targeting a Flash Player 6 audience, you might want to consider targeting Flash Player 10 as well
Why? Flash Player 6 is capable of running Express Install scripts, which enable a Flash movie to automatically
update the installed version of the Flash Player Also, users with Flash Player 7 or later can receive automatic
player updates By default, Flash Player 7 checks Adobe’s site every 30 days for new player updates This
pro-cess occurs silently in the background and doesn’t require the user to upgrade his or her player installation
manually Theoretically, then, within 30 days of the release of any new Flash Player, including Flash Player 10,
most browsers that had Flash Player 7, 8, or 9 will then have Flash Player 10 n
Trang 38For a complete list of features in Flash CS5, open the new browser-based help system by choosing Help ➪ Flash Help, and then selecting Using Flash ➪ Using Flash CS5 Professional ➪ Resources ➪ What’s New ➪ New Features.
Adobe also released new versions of Dreamweaver and Fireworks, as part of the CS5 Web Suite software bundle The user interfaces for Flash, Dreamweaver, and Fireworks are very similar, each touting a Property inspector, dockable panel sets, and specialized tools to integrate the products with one another
Although the broad array of Flash work created by Web designers and developers already speaks for itself, the sleek interface and the powerful new features of Flash CS5 surely inspire more chal-lenging, functional, entertaining, informative, bizarre, humorous, beautiful, and fascinating experi-ments and innovations
There are more ways to use Flash than there are adjectives to describe them, but here are just a few examples:
l Forms for collecting user information and dynamically loading custom content based on this interaction
l Real-time interaction with multiple users on a forum or support site, including live audio/
video feeds of connected parties
l Complex online games with rich graphics and interaction, including multiplayer games
l A video portfolio using Flash Video capabilities and dynamic loading of content
l Animated ID spots and loading screens with built-in download detection
l A practical Web utility, such as a mortgage calculator or a search tool
l Robust chat rooms based on XML and server-socket technology
l An audio interface dynamically pulling in requested songs, using native Flash Player port for MP3 loading
sup-l Interactive conceptual art experimentations involving several users, 3-D, or recording and playback of user interaction
l Shopping and e-commerce solutions built entirely by using Flash and server-side technology
l Interfaces for kiosks at museums, banks, and shopping centers
l Alternative content or movie attributes based on system capability testing (if a device or desktop doesn’t support audio streaming, then a text equivalent of the audio transcript is presented to the user)
l Projectors used for creating slide show presentations in the style of PowerPoint, either on CD-ROM or an alternative storage device
l Broadcast-quality cartoons, advertising, or titling
l Optimized animations for the Web, and for mobile devices such as cellphones or PDAs
Trang 39l An interface that addresses accessibility issues by modifying certain elements when a screen reader is active
l Flash movies specifically exported for use in digital video projects requiring special effects and compositing
l AIR applications built for the desktop that utilize data from popular social networking Web sites like Facebook and Twitter
l Casual, fun, addictive games for the iPhoneThis list is obviously far from complete and is ever expanding with each new release of the pro-gram As you can probably tell from this list, if you can imagine a use for Flash, it can probably be accomplished
The topography of Flash CS5
Before you attempt to construct interactive projects in Flash, you should be familiar with the ture of the authoring environment Even if you already know a previous version of Flash, learning this is advisable That’s because with the release of Flash CS5, Adobe has reorganized existing fea-tures to the interface and has either moved or improved other features and functionalities So, to get a firm footing in the new interface, I strongly suggest that you work your way through this book — from the beginning
struc-Cross-Reference
Chapter 4, “Interface Fundamentals,” introduces the updated Flash CS5 interface and gives you tips for
cus-tomizing your workspace and optimizing your workflow n
Moreover, you need to proactively plan your interactive projects before you attempt to author them in Flash An ounce of preplanning goes a long way during the production process Don’t fool yourself — the better your plan looks on paper, the better it performs when it comes to the final execution
Cross-Reference
I detail the foundation for planning interactive Flash projects in Chapter 3, “Planning Flash Projects,” and you
will find these concepts reiterated and expanded in chapters that discuss specific project workflows Chapter
19, “Making Your First Flash CS5 Project,” is a great place to start applying these planning strategies n
I consolidated the overview of interactive planning in the early chapters of the book In later ters, I included step-by-step descriptions of real-world projects that allow you to see how all the theory and planning suggestions apply to the development of specific projects
chap-There are two primary files that you create during Flash development: Flash document files (.fla) and Flash movie files (.swf) I discuss both of these formats next
Trang 40File types in Flash CS5
Flash document files (.fla) are architected to provide an efficient authoring environment for ects of all sizes Within this environment, content can be organized into scenes, and the ordering
proj-of scenes can be rearranged throughout the production cycle Layers provide easy separation proj-of graphics within each scene, and, as Guide or Mask layers, they can also aid drawing or even pro-vide special effects The Timeline shows keyframes, motion and shape tweens, labels, and com-ments The Library (which can be shared amongst movies at authortime or at runtime) stores all the symbols in your project, such as graphics, fonts, animated elements, sounds or video, and components
Flash documents
Throughout this book, you will see us refer to Flash documents (or Flash files), which are the fla files created by Flash CS5 when you choose File ➪ New and choose one of the Flash File options from the General category tab Unlike some graphics applications, such as Adobe Illustrator, the file icon or file extension for Flash documents does not reflect the version of the authoring tool
For example, all previous versions of Flash and now CS5 save Flash documents as fla files You cannot open later version documents in previous versions of the authoring tool You do not use Flash documents with the Flash Player, nor do you need to upload these files to your Web server
Always keep a version (and a backup!) of your Flash document
Tip
Flash CS5 allows you to resave your Flash CS5 document file (.fla) as a Flash CS4 document file Choose File ➪
Save As and select Flash CS3 Document in the Save as type menu If you save the document in this manner,
you can open the Flash document file in the Flash CS4 authoring application If the Flash CS5 document used
features unavailable in Flash CS4, you receive a warning as you save the document in the Flash CS4 format n
In Flash CS5, you have the option to create six different types of Flash files: ActionScript 3.0, ActionScript 2.0, Adobe AIR 2, iPhone, Flash Lite 4, or Adobe Device Central If you are targeting Flash Player 8 or earlier, you should always choose ActionScript 2.0 If you are targeting Flash Player 9 or later, and you want to use the advanced coding style of ActionScript 3.0, you should choose ActionScript 3.0 You can change your target version of ActionScript and the Flash Player at any time by clicking the Flash tab in the File ➪ Publish Settings dialog box If you want to deploy
a desktop application, choose Adobe AIR 2 AIR applications require ActionScript 3.0 If you want
to deploy content to mobile devices, use the Adobe Device Central option This option cally launches Device Central CS5, prompting you to choose a device profile to target with your Flash content
automati-New Feature
With the new iPhone file template, creating an iPhone application is now possible with Flash CS5 For more
information about creating iPhone applications using Flash, see Chapter 22 n