Learning_Flash.pdf

(1058 KB) Pobierz
000_Learning_Flash.book
Learning Flash
207414690.001.png
Trademarks
Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware,
Authorware Star, Backstage, Bright Tiger, Clustercats, ColdFusion, Contribute, Design In Motion, Director, Dream Templates,
Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, Fontographer, FreeHand, Generator, HomeSite,
JFusion, JRun, Kawa, Know Your Site, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live
Effects, MacRecorder Logo and Design, Macromedia, Macromedia Action!, Macromedia Flash, Macromedia M Logo and
Design, Macromedia Spectra, Macromedia xRes Logo and Design, MacroModel, Made with Macromedia, Made with
Macromedia Logo and Design, MAGIC Logo and Design, Mediamaker, Movie Critic, Open Sesame!, Roundtrip, Roundtrip
HTML, Shockwave, Sitespring, SoundEdit, Titlemaker, UltraDev, Web Design 101, what the web can be, and Xtra are either
registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions
including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may
be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions
including internationally.
Third-Party Information
This guide contains links to third-party websites that are not under the control of Macromedia, and Macromedia is not
responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your
own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia
endorses or accepts any responsibility for the content on those third-party sites.
Speech compression and decompression technology licensed from Nellymoser, Inc. (www.nellymoser.com).
Sorenson™ Spark™ video compression and decompression technology licensed from
Sorenson Media, Inc.
Opera ® browser Copyright © 1995-2002 Opera Software ASA and its suppliers. All rights reserved.
Apple Disclaimer
APPLE COMPUTER, INC. MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, REGARDING THE
ENCLOSED COMPUTER SOFTWARE PACKAGE, ITS MERCHANTABILITY OR ITS FITNESS FOR ANY
PARTICULAR PURPOSE. THE EXCLUSION OF IMPLIED WARRANTIES IS NOT PERMITTED BY SOME STATES.
THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. THIS WARRANTY PROVIDES YOU WITH SPECIFIC
LEGAL RIGHTS. THERE MAY BE OTHER RIGHTS THAT YOU MAY HAVE WHICH VARY FROM STATE TO
STATE.
Copyright © 2003 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced,
translated, or converted to any electronic or machine-readable form in whole or in part without prior written approval of
Macromedia, Inc. Part Numbe ZFL70M600
Acknowledgments
Director: Erick Vera
Project Management: Stephanie Gowin, Barbara Nelson
Writing: Jody Bleyle, Mary Burger, Kim Diezel, Stephanie Gowin, Dan Harris, Barbara Herbert, Barbara Nelson, Shirley Ong,
Tim Statler
Managing Editor: Rosana Francescato
Editing: Mary Ferguson, Mary Kraemer, Noreen Maher, Antonio Padial, Lisa Stanziano, Anne Szabla
Production Management: Patrice O’Neill
Media Design and Production: Adam Barnett, Christopher Basmajian, Aaron Begley, John Francis, Jeff Harmon
First Edition: October 2003
Macromedia, Inc.
600 Townsend St.
San Francisco, CA 94103
 
207414690.002.png
CONTENTS
INTRODUCTION: Learning Macromedia Flash MX 2004 . . . . . . . . . . . . . . . . . . . 9
Additional resources for learning Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
CHAPTER 1: Create a Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Take a tour of the user interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Change background and Stage size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Change your view of the Stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
View the Library panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Add graphics to the Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Add video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
View object properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Add video control behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Use the Movie Explorer to view the document structure . . . . . . . . . . . . . . . . . . . . 19
Test the document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Find help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
CHAPTER 2: Create Accessible Flash Content . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Specify that your document be accessible to screen readers . . . . . . . . . . . . . . . . . . 22
Provide a document title and description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Provide a title and description for instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Specify that screen readers ignore elements in your document . . . . . . . . . . . . . . . . 23
Change static text to dynamic text for accessibility . . . . . . . . . . . . . . . . . . . . . . . . 24
Control the tab order and reading order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
About testing your document with screen readers . . . . . . . . . . . . . . . . . . . . . . . . . 26
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CHAPTER 3: Write Scripts with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Create an instance of a symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Name button instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Initialize the document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
About ActionScript syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Locate ActionScript reference documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3
Add comments to ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Write a function for a button. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Copy and modify a button function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Check syntax and test your application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
CHAPTER 4: Create an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Copy input and dynamic text fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Name text fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Add and name a Button component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Declare variables and values for the prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Specify values for input text fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Write a function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Write an event handler for the component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Test your application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
CHAPTER 5: Work with Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Select a layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Hide and show layers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Lock a layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Add and name a layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Change the order of layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Organize layers in a folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Add a mask layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Add a guide layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Delete a layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CHAPTER 6: Create a User Interface with Layout Tools . . . . . . . . . . . . . . . . . . . 47
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Use guides to align an object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Change the Stage size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Resize objects to match the Stage size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Specify snap alignment settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Align an object using the alignment guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Align objects using the Align panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Snap objects to each other . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Align objects using the Property inspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Align objects using the grid and arrow keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4
Contents
 
CHAPTER 7: Draw in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Select a shape tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Select options to create a polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Draw a polygon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Rotate the shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Use the cut-out feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Transform the shape of your drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Copy strokes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Draw with the Line tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Select and add a different fill color. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Group the shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Create a logo with the Pen tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
CHAPTER 8: Create Symbols and Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
About creating symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Create a graphic symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Duplicate and modify an instance of a symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Modify a symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Create a movie clip symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Assign an instance name to the movie clip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Add an effect to the movie clip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 9: Add Animation and Navigation to Buttons . . . . . . . . . . . . . . . . . . . 67
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Create a button from grouped objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Name a button instance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
View the hit area by enabling buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Change the hit area of a button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Align buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Create animation for a button state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Add an action to a button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Add navigation to a button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Test the SWF file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CHAPTER 10: Add Static, Input, and Dynamic Text . . . . . . . . . . . . . . . . . . . . . . . 75
Set up your workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Create an expanding-width text block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Create a fixed-width text block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Edit text and change font attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Select device fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Add an input text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Copy a text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Contents
5
 
Zgłoś jeśli naruszono regulamin