This book teaches both ActionScript's fundamentals and its advanced usage. Over the next 675 meaty pages, we'll be exploring every detail of the ActionScript language -- from the basics of variables and movie clip control to advanced topics such as objects and classes, server communication, and XML. By the end, we'll have covered everything there is to know about Flash programming.
This book is not just for programmers. The text moves pretty quickly, but a prior knowledge of programming is not required to read it. All you need is experience with the non-ActionScript aspects of Flash and an eagerness to learn. Of course, if you are already a programmer, so much the better; you'll be applying your code-junkie skills to ActionScript in no time.
This book fully documents the material that may be undocumented or underdocumented by Macromedia or by other third-party books. Flash is notorious for word-of-mouth techniques and esoteric features. How are layers, movie clips, and loaded movies stacked in the Player? (See Chapter 13, "Movie Clips".) What governs the execution order of code on any given frame? (See Chapter 13, "Movie Clips".) Do event handlers have a local scope? (See Chapter 10, "Events and Event Handlers".) Why does the number 90 sometimes show up as 89.9999999997? (See Chapter 4, "Primitive Datatypes".) It has been my particular goal to chart these unknown waters. Of course, I also cover the basic programming techniques required in any language, such as how to make a segment of code execute repeatedly. (See Chapter 8, "Loop Statements".)
This book is designed to be kept on your desk, not to wallow away its life on your shelf. Part III, "Language Reference", exhaustively covers every object, class, property, method, and event handler in ActionScript. You'll use it regularly to learn new things and remind yourself of the things you always forget.
Above all, this book is a Definitive Guide. It's the product of years of research, thousands of emails to Macromedia employees, and feedback from users of all levels. I hope that it is self-evident that I've suffused the book with both my intense passion for the subject and the painfully won real-world experience from which you can benefit immediately. It covers ActionScript with exhaustive authority and -- thanks to a technical review by Gary Grossman, the creator of ActionScript -- with unparalleled accuracy.
Frankly, there's no practical limit to what a full-fledged language like Flash 5 ActionScript can achieve. Let's take a look at some of ActionScript's specific capabilities to offer a taste of the topics we'll cover throughout the book. Begin thinking about how you can combine these techniques to accomplish your particular goals.
Flash movies are composed of frames residing in a linear sequence called the timeline. Using ActionScript, we can control the playback of a movie's timeline, play segments of a movie, display a particular frame, halt a movie's playback, loop animations, and synchronize animated content.
Flash movies can accept and respond to user input. Using ActionScript, we can create interactive elements such as:
Buttons that react to mouseclicks (e.g., a classic navigation button)
Content that animates based on mouse movements (e.g., a mouse trailer)
Objects that can be moved via the mouse or keyboard (e.g., a car in a driving game)
Text fields that allow users to supply input to a movie (e.g., a fill-in form)
ActionScript can be used to examine or modify the properties of the audio and visual content in a movie. We may, for example, change an object's color and location, reduce a sound's volume, or set the font face of a text block. We may also modify these properties repeatedly over time to produce unique behaviors such as physics-based motion and collision detection.
Using ActionScript, we can generate visual and audio content directly from a movie's Library or by duplicating existing content on the Stage. Programmatically generated content may serve as a strictly static element, such as a random visual pattern, or as an interactive element, such as an enemy spaceship in a video game or an option in a pull-down menu.
ActionScript provides a wide variety of tools for sending information to and receiving information from a server. The following applications all involve server communication:
Link to a web page
Guest book
Chat application
Multiplayer networked game
E-commerce transaction
Personalized site involving user registration and login
These examples, of course, offer only a limited account of potential ActionScript applications. The goal of this book is to give you the fundamental skills to explore the myriad other possibilities on your own. This is not a recipe book -- it's a lesson in cooking code from scratch. What's on the menu is up to you.
Copyright © 2002 O'Reilly & Associates. All rights reserved.