Macromedia Flash 5 - ActionScript Reference Guide.pdf
(
3868 KB
)
Pobierz
000_ASRG.book
macromedia
®
ActionScript Reference Guide
FLASH
™
5
Trademarks
Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware,
Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage
Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, Design in Motion, Director, Director Multimedia Studio,
Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks, Flash, Fontographer,
FreeHand, FreeHand Graphics Studio, Generator, Generator Developer's Studio, Generator Dynamic Graphics Server, Knowledge
Objects, Knowledge Stream, Knowledge Track, Lingo, Live Effects, Macromedia, Macromedia M Logo & Design, Macromedia Flash,
Macromedia Xres, Macromind, Macromind Action, MAGIC, Mediamaker, Object Authoring, Power Applets, Priority Access, Roundtrip
HTML, Scriptlets, SoundEdit, ShockRave, Shockmachine, Shockwave, Shockwave Remote, Shockwave Internet Studio, Showcase, Tools
to Power Your Ideas, Universal Media, Virtuoso, Web Design 101, Whirlwind and Xtra are 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, servicemarks, or tradenames of Macromedia, Inc. or other entities and
may be registered in certain jurisdictions including internationally.
This guide contains links to third-party Web sites 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 Web site 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.
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 © 2000 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 Number ZFL50M200
Acknowledgments
Project Management: Erick Vera
Writing: Jody Bleyle, Mary Burger, Louis Dobrozensky, Stephanie Gowin, Marcelle Taylor, and Judy Walthers Von Alten
Editing: Peter Fenczik, Rosana Francescato, Ann Szabla
Multimedia: George Brown, John “Zippy” Lehnus, and Noah Zilberberg
Print and Help Design: Chris Basmajian and Noah Zilberberg
Production: Chris Basmajian and Rebecca Godbois
Special thanks: Jeremy Clark, Brian Dister and the entire Flash Development team, Margaret Dumas, Kipling Inscore,
Alyn Kelley and the entire Flash QA team, Pete Santangeli, Cyn Taylor, and Eric Wittman
First Edition: July 2000
Macromedia, Inc.
600 Townsend St.
San Francisco, CA 94103
2
CONTENTS
INTRODUCTION
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
What’s new in Flash 5 ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Using Flash Help for actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
CHAPTER 1
Understanding ActionScript . . . . . . . . . . . . . . . . . . . . .11
About scripting in ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
ActionScript terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Deconstructing a sample script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Using the Actions panel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Assigning actions to objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Assigning actions to frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
CHAPTER 2
Writing Scripts with ActionScript. . . . . . . . . . . . . . . .37
Using ActionScript’s syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
About data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
About variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Using operators to manipulate values in expressions . . . . . . . . . . . . . . 51
Using actions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Controlling flow in scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Using predefined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Creating custom functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Using predefined objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using custom objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Opening Flash 4 files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Using Flash 5 to create Flash 4 content . . . . . . . . . . . . . . . . . . . . . . . . 77
3
CHAPTER 3
Creating Interaction with ActionScript . . . . . . . . . . .79
Creating a custom cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Getting the mouse position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
Capturing keypresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Creating a scrolling text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .86
Setting color values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88
Creating sound controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
Detecting collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94
CHAPTER 4
Working with Movie Clips. . . . . . . . . . . . . . . . . . . . . . .97
About multiple Timelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98
Using actions and methods to control Timelines . . . . . . . . . . . . . . . .111
Creating smart clips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119
CHAPTER 5
Integrating Flash with Web Applications. . . . . . . .125
Sending and loading variables to and from a remote file . . . . . . . . . . .126
Creating forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137
Sending messages to and from the Flash Player . . . . . . . . . . . . . . . . . .141
CHAPTER 6
Troubleshooting ActionScript. . . . . . . . . . . . . . . . . .145
Authoring and troubleshooting guidelines. . . . . . . . . . . . . . . . . . . . . .145
Using the Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148
Using the Output window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
CHAPTER 7
ActionScript Dictionary. . . . . . . . . . . . . . . . . . . . . . . . 157
Sample entry for most ActionScript elements . . . . . . . . . . . . . . . . . . .158
Sample entry for objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159
Contents of the dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
4
Contents
APPENDIX A
Operator Precedence and Associativity. . . . . . . . .431
APPENDIX B
Keyboard Keys and Key Code Values . . . . . . . . . 435
Letters A to Z and standard numbers 0 to 9 . . . . . . . . . . . . . . . . . . . .435
Keys on the numeric keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .437
Function keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .438
Other keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .439
APPENDIX C
Error Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .441
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Contents
5
Plik z chomika:
Automation_Engineering
Inne pliki z tego folderu:
PHP for Flash.rar
(28723 KB)
Po prostu Flash 5 - techniki zaawansowane.rar
(5937 KB)
Flash 5 - Książka Generator Następny krok.rar
(4227 KB)
Flash 5 biblia.rar
(10553 KB)
Macromedia Flash 5 - ActionScript Reference Guide.pdf
(3868 KB)
Inne foldery tego chomika:
Kurs Alembler
Kurs ASP
Kurs C
Kurs C#
Kurs C++
Zgłoś jeśli
naruszono regulamin