Tải bản đầy đủ (.pdf) (699 trang)

Foundation Flash CS4 for Designers docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (22.84 MB, 699 trang )

Foundation Flash CS4
for Designers
Tom Green and David Stiller
Lead Editor
Ben Renow-Clarke
Technical Reviewer
Tiago Dias
Editorial Board
Clay Andres, Steve Anglin, Mark Beckner,
Ewan Buckingham, Tony Campbell, Gary Cornell,
Jonathan Gennick, Michelle Lowman,
Matthew Moodie, Jeffrey Pepper,
Frank Pohlmann, Ben Renow-Clarke,
Dominic Shakeshaft,
Matt Wade, Tom Welsh
Project Manager
Beth Christmas
Copy Editor
Marilyn Smith
Associate Production Director
Kari Brooks-Copony
Production Editor
Laura Cheu
Compositor
Lynn L’Heureux
Proofreader
Liz Welch
Indexer
Carol Burbo
Artist


Kinetic Publishing Services, LLC
Cover Image Designer
Corné van Dooren
Interior and Cover Designer
Kurt Krames
Manufacturing Director
Tom Debolski
Foundation Flash CS4 for Designers
Copyright © 2009 by Tom Green and David Stiller
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the
copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-1093-1
ISBN-13 (electronic): 978-1-4302-1094-8
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name,
we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone
1-800-SPRINGER, fax 201-348-4505, e-mail kn`ano)ju<olnejcan)o^i*_ki, or visit sss*olnejcankjheja*_ki.
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705.
Phone 510-549-5930, fax 510-549-5939, e-mail ejbk<]lnaoo*_ki, or visit sss*]lnaoo*_ki.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at
dppl6++sss*]lnaoo*_ki+ejbk+^qhgo]hao.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the
preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or
damage caused or alleged to be caused directly or indirectly by the information contained in this work.
The source code for this book is freely available to readers at sss*bneaj`okba`*_ki in the Downloads section.
Credits

To Brian and Carl in British Columbia because
I have run out of people.
—Tom Green
To Lotte Reiniger, creator of the oldest surviving animated
feature film (Die Abenteuer des Prinzen Achmed, 1926),
whose work hinges on the principles described in Chapter 8.
—David Stiller
v
CONTENTS AT A GLANCE
About the Authors xix
About the Technical Reviewer
xxi
About the Cover Image Designer
xxiii
Acknowledgments
xxv
Introduction
xxvii
Chapter 1 LEARNING THE FLASH CS4 PROFESSIONAL INTERFACE
3
Chapter 2 CREATING ARTWORK IN FLASH
55
Chapter 3 SYMBOLS AND LIBRARIES 121
Chapter 4 ACTIONSCRIPT BASICS 171
Chapter 5 AUDIO 221
Chapter 6 TEXT
253
Chapter 7 ANIMATION
301
Chapter 8 ANIMATION, PART 2 363

Chapter 9 FLASH GETS A THIRD DIMENSION 417
Chapter 10 VIDEO 441
Chapter 11 BUILDING INTERFACES WITH THE UI COMPONENTS
493
Chapter 12 CSS
531
Chapter 13 XML (DYNAMIC DATA)
557
Chapter 14 BUILDING STUFF
579
Chapter 15 OPTIMIZING AND PUBLISHING FLASH MOVIES 637
Index
685
vii
About the Authors xix
About the Technical Reviewer
xxi
About the Cover Image Designer
xxiii
Acknowledgments
xxv
Introduction
xxvii
Chapter 1 LEARNING THE FLASH CS4 PROFESSIONAL INTERFACE
3
Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Creating a new Flash document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Managing your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Setting document preferences and properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Document preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Document properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Zooming the stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Exploring panels in the Flash interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
The Timeline panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Animation and the timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Understanding frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
The Property inspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
The Tools panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
The Library panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
The Motion Editor panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
The Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Using layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Layer modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Creating layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Adding content to layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Showing/hiding and locking layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Grouping layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Your turn: build a Flash movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Preparing the stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Adding the sky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Adding the mountains and playing with color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Using trees to create the illusion of depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Using a motion tween to create a twinkling star . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
CONTENTS
CONTENTS
viii
Adding a moon over Lake Nanagook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Making some moonshine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Breaking the stillness of the night at Lake Nanagook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Testing your movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Making the moon rise over Lake Nanagook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Lighting up Lake Nanagook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 2 CREATING ARTWORK IN FLASH 55
Flash’s two kinds of artwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
The Tools panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Selecting and transforming objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Selection and Subselection tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Free Transform tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
The Gradient Transform tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Object Drawing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64
Drawing in Flash CS4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
The Pencil tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
The Brush tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
The Deco tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
The Spray Brush tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
The Eraser tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
The Pen tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Your turn: Trees grow at Lake Nanagook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Drawing the tree trunk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Drawing the pine tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Adding pine needles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Working with color. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
The Color panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Color models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Color palette and Color Picker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Creating persistent custom colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
The Kuler Color Picker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Your turn: Play with color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Creating gradient effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

Locking a fill. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Using an image as a fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Using bitmap images in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Importing image files into Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Editing imported bitmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
Tracing bitmaps in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Tracing an image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
Optimizing the drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Using JPG files in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Using GIF files in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Working with GIF images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Working with GIF animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
CONTENTS
ix
Importing Fireworks CS4 documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Importing Illustrator CS4 documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Importing an AI file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Copying and pasting an AI file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Putting the AI file on the stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Importing Photoshop CS4 documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Importing a PSD file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Notes from the PSD file import front . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Creating a banner ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Chapter 3 SYMBOLS AND LIBRARIES 121
Symbol essentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Creating a symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Understanding symbol types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Graphic symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Button symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

Movieclip symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Editing symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
9-slice scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
How 9- slice scaling works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Your turn: Frames for Peter Pan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
9-slice “gotchas” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Sharing assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Author-time shared libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Runtime shared libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Updating shared assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
A word from the bunnies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Filters and blend modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Applying filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Applying a Drop Shadow filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Adding perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Some filter facts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Playing with blends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Managing content on the stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Grouping content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Aligning objects by snapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Using Snap Align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Snapping to the grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Aligning with guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Snapping in a guide layer and to pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Stacking order and using the Align panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Stacking objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Distributing to layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Using the Align panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
CONTENTS
x

Masks and masking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Creating a simple mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Creating a masked animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Using text as a mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Your turn: Create a soft mask in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Setting up the stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Creating the cutout for the mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
A mask without a masking layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Chapter 4 ACTIONSCRIPT BASICS 171
The power of ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
The Actions panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Actions panel components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Actions toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Script navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Script pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Panel context menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
The Actions panel vs. the Behaviors panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Everything is an object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Using instance names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Setting properties via ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Coding fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Capitalization matters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Semicolons mark the end of a line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Mind your keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Commenting code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Dot notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Conditional statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Class files and the document class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Syntax checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
How to read the ActionScript 3.0 Language and Components Reference . . . . . . . . . . . . . . . . 210
Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Search tactics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Using ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Your turn: Pause and loop with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Pausing a timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Looping a timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
CONTENTS
xi
Chapter 5 AUDIO
221
Flash and audio formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Bit depth and sample rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Flash and MP3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Adding audio to Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Importing an audio file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Setting sound properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Using audio in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Choosing a sound type: event or streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Removing an audio file from the timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

Getting loopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Adjusting volume and pan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
A note from a master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Your turn: Add sound to a button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Controlling audio with ActionScript 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Playing a sound from the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Using a button to play a sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Playing a sound from outside Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Turning an external sound on and off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Adjusting volume with code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Your turn: Let users select from multiple audio files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Setting up the component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Wiring up the Play button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Testing the movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Chapter 6 TEXT 253
Type basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Adobe CoolType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
A little screen type history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
CoolType to the rescue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Typefaces and fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Working with device fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Types of text fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Static text properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Character properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Paragraph properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Options properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Your turn: Play with static text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Applying a filter to text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Exploding text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Applying a Blend mode and color to text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Dynamic text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Adding text to a dynamic text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Formatting text with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Creating a text field with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Input text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
HTML formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
CONTENTS
xii
Hyperlinks and Flash text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Using HTML for hyperlinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Using hyperlinks to trigger ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Your turn: A visit to the pond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Using hyperlinks with a static text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Using hyperlinks with a dynamic text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Embedding font outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Embedding font outlines in individual text fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Choosing a character set to embed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Applying character embedding correctly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Using font symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Checking spelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Your turn: Scrollable text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Using the UIScrollBar component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Rolling your own scroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Chapter 7 ANIMATION 301
Shape tweening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Scaling and stretching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Modifying shape tweens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Altering shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308

Examining anchor points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Shape changing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Shape hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Altering gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Classic tweening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Classic tween properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Scaling, stretching, and deforming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Easing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Custom easing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Adding anchor points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Easing multiple properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Using animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
A closer look at the Timeline panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Onion skinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Modifying multiple frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Swapping graphic symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Editing multiple frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Combining timelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Movieclip timelines vs. graphic symbol timelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Nesting symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Graphic symbols as mini- libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Classic tween effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Applying tween effects to an image converted to a symbol . . . . . . . . . . . . . . . . . . . . . 340
Applying a filter to a tween . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Alpha tweening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Motion guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
CONTENTS
xiii
Tweening a mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Animating a mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Using motion guides with masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Your turn: Make an animated button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Adding some animated glint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
An even cooler animated button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Copying motion as ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Your turn: Complete an animated scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Chapter 8 ANIMATION, PART 2 363
Animating with the Motion Editor panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Getting acquainted: scaling and moving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Easing with graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Built-in eases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Creating custom eases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Applying multiple eases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Managing property keyframes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Changing duration proportionally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Changing duration nonproportionally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Motion paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Manipulating motion paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Using advanced motion paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Motion tween properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Motion presets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Inverse kinematics (IK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Using the Bone tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Bone tool properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Constraining joint rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Deleting bones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Applying joint translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
A note about bone preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402

Animating IK poses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Using the Bind tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Shape IK and fills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Shape IK and anchor points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Your turn: Animate a fully rigged IK model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Inspiration is everywhere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Chapter 9 FLASH GETS A THIRD DIMENSION 417
What 3D really means in Flash (and what it doesn’t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Understanding the vanishing point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Using the 3D tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
The 3D Rotation tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Old-school 3D rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
New 3D rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
The 3D Translation tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
CONTENTS
xiv
Strategies for positioning content in 3D space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Share 3D rotation and translation settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Use the 3D center point to your advantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Be aware of depth limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Your turn: Simulate a photo cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Chapter 10 VIDEO 441
Video on the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Video formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Encoding an FLV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Using the Adobe Media Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Previewing and trimming video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
Video settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

Audio settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Cropping video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Running the render process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Batch encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Playing an FLV in Flash CS4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Using the wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
A word about file paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Using the FLVPlayback component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Playing video using ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Using the FLVPlayback control components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Adding captions with the FLVPlaybackCaptioning component . . . . . . . . . . . . . . . . . . . . . . 469
Preparing and using alpha channel video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Going full screen with video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Full-screen video the ActionScript/HTML way . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Full-screen video the easy way . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
When video is not video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Embedding video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Embedding video as a movieclip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Interacting with video content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Adding cue points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
An alternate XML format for cue points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Your turn: Create XML captions for video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Your turn: Play with alpha video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Chapter 11 BUILDING INTERFACES WITH THE UI COMPONENTS 493
Button component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Using the Button component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Adding button events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Referencing components in event handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Considering UI component weight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

CONTENTS
xv
Changing the Button component’s appearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Skinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Styling components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
CheckBox component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
ColorPicker component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
ComboBox component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
DataGrid component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Label component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
List component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
NumericStepper component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
ProgressBar component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
RadioButton component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
ScrollPane component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Slider component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
TextArea component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
TextInput component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
TileList component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
UILoader component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
UIScrollBar component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Chapter 12 CSS 531
Styling with CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Element selectors vs. class selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Block element styling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Inline element styling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Custom tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Style inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Styling hyperlinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

Embedded fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Selectors vs. the Property inspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
Loading external CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
Chapter 13 XML (DYNAMIC DATA) 557
Writing XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
Loading an XML file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Using E4X syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Dots and @s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Node types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
E4X filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
Double dots and more . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
Your turn: Draw shapes with XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
CONTENTS
xvi
Chapter 14 BUILDING STUFF
579
Loading content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
Dynamic loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
One loader, multiple SWFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Creating a movie preloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Building a slide show with components and XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
A tour of the Beijing art district . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
Extending the tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Building an MP3 player with XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Setting up the external playlist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Polishing up the symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
Renaming library assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600

Improving the controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
Wiring up the MP3 player controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
Handling the button events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
Programming the sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Finishing up the controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Evaluating and improving the MP3 player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
Building a video controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Assembling the controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Wiring up the video player controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
Handling the button events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Programming the slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Using timers to rewind and fast- forward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Chapter 15 OPTIMIZING AND PUBLISHING FLASH MOVIES 637
Flash’s love- hate Internet relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
This “Internet” thing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Enter the World Wide Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
So who are these folks we call users? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
Streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
The Bandwidth Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Simulating a download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Pinpointing problem content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Can I get that in writing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Optimizing and fine- tuning your Flash movies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Planning your movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Distributing the weight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Optimizing elements in the movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
Optimizing Flash content for use in video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Publishing and web formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662

Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
xvii
CONTENTS
Animated GIFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664
Exporting as an animated GIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Importing an animated GIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
QuickTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
It’s showtime! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Publish settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Flash settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
HTML settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Publishing Lake Nanagook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
Publishing Flash movies containing linked files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
What you have learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Index 685
xix
Tom Green is currently Professor of Interactive Media in the
School of Media Studies at the Humber Institute of Technology
and Advanced Learning in Toronto, Canada. He has written
eight previous books on Adobe technologies and many articles
for numerous magazines and websites, including Layers maga-
zine, Community MX, Digital Web Magazine, and Computer
Arts. He has spoken at more than 20 conferences internation-
ally, including Adobe MAX, National Association of Broadcasters
(NAB), FITC, MX North, Digital Design World, TODCon, and
SparkEurope. You can contact Tom at pki<pkikjpdasa^*_].
David Stiller is an independent contractor whose portfo-
lio includes multimedia programming and design for the

US National Aeronautics and Space Administration (NASA),
US Department of Transportation (DOT), Nickelodeon,
MTV, Wendy’s, Adobe, and dozens of clients across the
United States and Canada. David gets a kick out of shar-
ing “aha!” moments with others through consultation and
mentoring, as well as regular contributions to the Adobe
Flash and ActionScript forums; his blog (dppl6++mqel*jap+
^hkc+); and articles for Community MX, Layers magazine,
and other outlets. You can contact David using the form on his website (dppl6++mqel*jap+
_kjp]_p*ldl). In off hours, his interests include unicycling, anaglyph 3D photography, finely
crafted wooden game boards, Library of Congress field recordings, and Turkish coffee. David
lives in Virginia with his amazing wife, Dawn, and his beguiling daughter, Meridian.
ABOUT THE AUTHORS
xx
Tiago Dias started to get into Flash around the time of Flash 3,
after seeing a Flash site for the first time. He started off by doing
freelance work on the side from his day job as a network/sys-
tems engineer. On the motion graphics side of things, he got a
lot of After Effects and Premiere experience at multimedia
school in Zurich. From those humble beginnings, he now works
as a video producer and Flash developer at a corporate televi-
sion and news production company based in London with sub-
sidiaries around the world. This is Tiago’s ideal job, as it combines
two of his favorite technologies! In his free time, he writes tuto-
rials on Flash and After Effects for various communities, tries to
go snowboarding every time the sun is shining in the Swiss Alps,
or hops on a plane to visit new countries. He currently lives and
works in Zurich, Switzerland.
ABOUT THE TECHNICAL REVIEWER
xxi

Corné van Dooren designed the front cover image for this
book. After taking a brief from friends of ED to create a new
design for the Foundation series, he worked at combining tech-
nological and organic forms, with the results now appearing on
this and other books’ covers.
Corné spent his childhood drawing on everything at hand, and
then began exploring the infinite world of multimedia—and
his journey of discovery hasn’t stopped since. His mantra has
always been “The only limit to multimedia is the imagination,” a
saying that keeps him moving forward constantly.
Corné works for many international clients, writes features for
multimedia magazines, reviews and tests software, authors mul-
timedia studies, and works on many other friends of ED books.
You can see more of his work at and contact him through his
website, dppl6++sss*_knjar]j`kknaj*_ki.
If you like Corné’s work, be sure to check out his chapter in New Masters of Photoshop: Volume 2
(friends of ED, 2004).
ABOUT THE COVER IMAGE DESIGNER
xxiii
As I said in the CS3 version of this book, “Working with a coauthor can be a tricky business. In
fact, it is a lot like a marriage. Everything is wonderful when things are going well, but you never
really discover the strength of the relationship until you get deep into it.” When David and I
started working together on this volume’s predecessor, I don’t think either of us expected it to
become the deep friendship and close professional relationship that has developed over the
past couple of years. It truly is an incredible experience to write a book with a coauthor when
you can’t tell who wrote what in the book.
What makes this partnership work is that we both are passionate about what we do and are
unwilling to settle for the path of least resistance. Many are the times Dave yanked me off that
path, gave me a good shake, and shoved me forward.
We also didn’t merrily go our separate ways when the CS3 book was released. Both of us started

listening in on conversations going on at Amazon, talked to teachers around the world who
were using the book, and even corralled a few readers at conferences and other industry gath-
erings to ask a simple question: what can we improve? This book is the result of those conversa-
tions, and to all of you who told us, in no uncertain terms, where things needed to change, we
offer you our thanks.
As we dug into this book, we realized that we could tell you what to do, but the “names” in this
business could reinforce, from personal experience, the concepts. We deeply appreciate the
help we got from Jennifer Shiman, Kristen Henry, Chris Georgenes, John Kricfalusi, and David
Schroeder for sharing their experiences and insights with you.
Next up is our editor, Ben Renow-Clarke. This is the first book I have written with him, and I’m
thrilled that we also connected at a personal and professional level. Ben stayed out of the way,
but was always there when we got stuck and needed a kick in the pants or a “have you thought
of this . . . ?” idea.
Finally, writing a book means I hole myself up in my office and become generally moody and
difficult to be around as I mull over a technique or try to identify why something isn’t quite
working. It takes a very unique individual to live with that, let alone understand why—and my
wife, best friend, and life partner over the past 30 years, Keltie, has somehow put up with it.
Tom Green
ACKNOWLEDGMENTS
xxiv
ACKNOWLEDGMENTS
When Tom invited me to jam on the Foundation Flash riff a second time, there was no question
I’d oblige. It has been ridiculously cool to hear feedback on forums, in e-mail, and at confer-
ences, and to see firsthand the creative outlet people get from Flash. I really do appreciate the
way these books keep me in touch with friends and acquaintances in the Flash community.
(Never mind that it’s a hoot eating crocodile tail with Tom Green. Conferences aren’t just for
tech talk!)
I tend to think of this second edition in terms of jazz: all the great standards have a recogniz-
able tune (of course!). In that sense, this is “the same book” as the first edition. But like any jazz
performance, you’re getting a new interpretation of the standard. In this case, the performance

is more nuanced than the first one, with new melodies and a better sense of cohesion overall.
You’re also getting a considerably bigger page count with this book, because Flash CS4 gives you
so much more to do! The improvements, revisions, and new material in this edition are largely
the result of input from readers, students, colleagues, and friends.
Over the years, I’ve learned quite a bit about programming and life in general from a dear friend
who both exists and does not, and who goes by the name Uncle Chutney. “Big things are made
up of lots of little things,” he keeps telling me, and he’s right. That proverb has gotten me out
of many a tight squeeze.
Numerous people helped us write this book, from engineers at Adobe and partners at
Community MX to IM buddies at the ready to test this-and-that, lend a pair of ears, or simply
laugh (or not) at a pun. For me, that list includes Marisa Bozza, Noah DiCenso, Jen deHaan, Greg
Dove, Tink (Stephen Downs), Chris Georgenes, Branden Hall, Bruce Hartman, Ted Johns, Keenan
Keeling, San Khong, John Mayhew, Trevor McCauley, Colin Moock, Amy Niebel, Robert Penner,
Nivesh Rajbhandari, Robert Reinhardt, Steve Schelter, Rich Shupe, and dozens more.
While writing this book, I took an exciting journey through the first seven of L. Frank Baum’s
Oz books with my daughter. At the same time, my wife introduced me to the magic of Georges
Méliès. These books and films were a remarkable encouragement to me, made all the more
enchanting by the family who enjoyed them with me. Danke, für deine Phantasie, Meridian;
thanks, Dawn, as always, for being my best friend.
David Stiller
xxv
I can remember the day as clear as if it were just yesterday. I was walking by my boss’s office late
one winter afternoon at the college where I teach, and he called me into his office. Sitting on his
desk was a thin, white box with some sort of weird swirl on it. He slid the box across to me and
asked, “You know anything about Flash?”
To be honest, as a Director user, what I knew about Flash was filtered through the eyes of a
Director guy, which meant I didn’t know much, and what I did know convinced me it was a
windup toy compared to Director. I replied, “A bit.” The boss leaned back in his chair and said,
“Well learn a lot more because you are teaching it in four weeks.” This was the start of one of
the longest, strangest, and most exhilarating trips I have ever been on. The version was Flash 3,

and I have been using and teaching Flash ever since.
Flash CS4 will most likely be regarded by the industry as one of the most significant in the his-
tory of the product. Flash CS4 has evolved into a serious design tool, able to handle everything
from simple motion graphics to broadcast-quality animations. It also marks the point where
Flash is fully integrated into the Adobe product lineup. The new Motion Editor, a rejigged Media
Encoder, and a fistful of sophisticated animation tools are evidence of that.
This book is also a bit different from any Flash book you may have read or considered pur-
chasing. From the very start of the process, Dave and I put ourselves in your shoes and asked
a simple question: what do you need to know and why? This question led us into territory that
we didn’t quite expect. As we were grappling with that question early in the process, we kept
bothering our network of Flash friends to be sure we were on the right track. At some point,
both of us simultaneously came to this conclusion: why not just let them explain it in their own
words? This is why, as you journey through this book, you will encounter various experts in the
field telling you why they do things and offering you insights into what they have learned. The
encouraging thing is that at some point in their careers, they were no different from you.
One other aspect of this book is that we had a lot of fun developing the examples and exercises.
The fun aspect is important, because if learning is fun, what you learn will be retained. Anyone
can show you how to apply a Glow filter to a line on the Flash stage. It is more effective when you
do exactly the same thing to a guy wearing a Tron costume. Anyone can dryly explain 9-slice scal-
ing, but it becomes less techie when you apply it to a guy dressed as Peter Pan. Nested movieclips
are a “yawner” at best, but when they are related to a Hostess Twinkie, the concept becomes
understandable. Shared libraries are an important subject. Instead of filling a library with circles
and text, the concept becomes relevant when the library is populated with “bunny bits.” Need to
experience how to mix high-definition video with regular FLV video? Why not mix up a cutting-
edge Chinese motion graphics piece by a student in Beijing with a beatbox flautist in New York?
As you may have guessed, we continue to exhibit a sense of joy and wonder with Flash, and we
hope a little of our enthusiasm rubs off on you as well.
INTRODUCTION
xxvi
INTRODUCTION

Book structure and flow
To start, this is not a typical Foundation book. There is no common project that runs throughout
the book. Instead, each chapter contains a number of exercises to help you develop some “Flash
chops,” and then we turn you loose in the “Your turn” section.
We start by dropping you right into the application and creating a small Flash movie we call
“Moonrise Over Lake Nanagook” (told you we were having fun). This chapter familiarizes you
with the Flash workspace and the fundamentals of using Flash Professional CS4. Chapter 2 intro-
duces you to working with the graphic tools and graphics files, and finishes with the exploration
of a Monty Python–style banner ad.
Chapter 3 introduces you to symbols and libraries in Flash CS4. In this chapter, you learn how
to create and use symbols, and we even let Peter Pan explain how 9-slice scaling works. With
those fundamentals under your belt, we show you how to share symbols and libraries between
movies, and how to manipulate symbols with filters and blend effects. Along the way, you travel
from a riot in Paris to Times Square, discovering how to create some rather powerful effects in
your Flash movies. The chapter finishes by showing you how to use masks to your advantage in
Flash.
After Chapter 3, you have pretty well mastered the fundamentals. The rest of the book builds
upon what you have learned. Chapter 4 picks you up and throws you into the ActionScript 3.0
pool. Don’t worry if you’re not a programmer! Chapter 5 starts by explaining how to use audio
in Flash and finishes with constructing the beginnings of an MP3 player. Chapter 6 reinforces
the message that text isn’t the gray stuff that surrounds your animations. We show you how it
is both serious and fun by stepping through how to create scrolling text and how to blow up
your name.
Chapter 7 is one of the more important chapters in the book because Flash began as an anima-
tion application. You learn the full arsenal of basics here, but don’t expect to be shoving boxes
and circles around. You will be banging hammers, eating apples, dropping parrots, lighting up a
Tron suit, and setting a butterfly in motion. Did we mention we believe in having fun? Chapter
8 continues the animation theme by getting you deep into the new Motion Editor and inverse
kinematics (IK) tools. Chapter 9 walks you through the 3D tools introduced in Flash CS4.
From animation, we move to video in Flash. In Chapter 10, we show the entire process, from

encoding to upload. In fact, the chapter finishes with a “Your turn” in which you add captions
and a full-screen capability to a Superman movie. Along the way, you will visit heaven and also
meet a rather neurotic cartoon character.
Chapters 11, 12, and 13 give you the chance to play with all of the Flash user interface com-
ponents, actually style a Flash movie using Cascading Style Sheets (CSS), and explore how XML
gives you a huge amount of flexibility when it comes to adding dynamic data to your movie.
Chapter 14 is where you get to pull it all together and build everything from a simple preloader
to a completed version of the MP3 player you started in Chapter 5. Along the way, you also cre-
ate a custom slide show and code up a custom video player that weighs in at under 10KB.
The final chapter focuses on the end game of the design process. It shows you a number of
the important techniques you need to know that will keep your movies small and efficient. You
INTRODUCTION
xxvii
also learn how to create the SWF that will be embedded into a web page, and how to keep that
process as smooth as possible.
Finally, David and I are no different from you. We are learning about this application—what it can
and cannot do—at the same time as you are learning about it. Though we may be coming at it
from a slightly more advanced level, there is a lot about this application we’re still discovering. If
there is something we have missed or something you don’t quite understand, by all means, con-
tact us. We’ll be sure to add it to the book’s site. And here are our final words of advice for you:
The amount of fun you can have with this application should be illegal. We’ll see you in jail!
Layout conventions
To keep this book as clear and easy to follow as possible, the following text conventions are
used throughout.
Important words or concepts are normally highlighted on the first appearance in italics.
Code is presented in beta`)se`pdbkjp.
New or changed code is normally presented in ^kh`beta`)se`pdbkjp.
Pseudo-code and variable input are written in ep]he_beta`)se`pdbkjp.
Menu commands are written in the form Menu ° Submenu ° Submenu.
Where I want to draw your attention to something, I’ve highlighted it like this:

Ahem, don’t say we didn’t warn you.
Sometimes code won’t fit on a single line in a book. Where this happens, I use an arrow
like this: ±
Pdeoeo]ranu(ranuhkjcoa_pekjkb_k`apd]podkqh`^asneppaj]hh
±kjpdao]iahejasepdkqp]^na]g*
Tom Green
3
Welcome to Flash CS4 Professional. We suspect you are here because you have seen
a lot of the great stuff Flash can do, and it is now time for you to get into the game.
Flash can be one great big, scary application to those unfamiliar with it. Or you may
be here because, as a Flash user, you have found that CS4 is suddenly a lot different
from Flash 8 or Flash CS3, and you need to get up to speed with this new stuff in
relatively short order. In either case, both of the authors have been in your shoes
at some point in our careers, which means we understand what you are feeling. So
instead of jumping right into the application, let’s go for a stroll.
Here’s what we’ll cover in this chapter:
Exploring the Flash interface
Using the stage
Working with panels
Understanding the difference between a frame and a keyframe
Using frames to arrange content on the stage
Using layers to manage content on the stage
Adding objects to the library
Testing your movie
LEARNING THE FLASH CS4
PROFESSIONAL INTERFACE
Chapter 1

×