Audience
My coauthors and I assume you have some experience with scripting in
either Flash ActionScript, ECMAScript, or JavaScript, but the book is
designed to meet the needs of a wide variety of readers with varying
backgrounds and interests. Where ActionScript is discussed,
familiarity with the Flash development environment is assumed. If
you're new to the Flash authoring tool,
you'll want to read Flash Out of the
Box (O'Reilly). This book is not designed
as an introductory step-by-step tutorial to programming in Flash.
There is a wonderful and growing variety of books and sources on
Flash programming. If you have little or no experience with
ActionScript programming, you should consult ActionScript
for Flash MX: The Definitive Guide and Essential
ActionScript 2.0 (both from O'Reilly).
If you are looking for a step-by-step introduction to programming
FlashCom, have a look at the introductory chapters of this book. If
you feel they are over your head, consult the resources cited in the
previous paragraph before returning to this book. Also consider books
such as Flash Remoting: The Definitive Guide and
the ActionScript Cookbook (also from
O'Reilly) for targeted coverage of other areas of
interest.
The book is not a printed version of the online documentation, nor
does it attempt to reproduce materials on widely available topics,
such as how to install FlashCom. Instead, it is designed to clarify
and extend the information provided by Macromedia's
documentation and web site. See in particular the documentation
available at:
- http://www.macromedia.com/support/documentation/en/flashcom/index.htm
This book was written by people who have used FlashCom and
Macromedia's documentation from the earliest days of
the product. We all had to struggle to understand just what
Macromedia had given us and hope to help you avoid having to repeat
all our early tests and experiments. The book is designed to be read
and reread as your experience developing Flash communication
applications increases.
The changes in Flash from versions 4 to 5 were revolutionary, and the
changes from version 5 to MXamong them components and video
supportwere also very dramatic. Flash MX 2004 introduced
ActionScript 2.0 and added an entire new set of user interface
components. ActionScript 2.0 added some features familiar to C++ and
Java programmers, such as strong typing and formal classes.
In Chapter 1 through Chapter 12, the book's client-side
ActionScript examples are written in both ActionScript 1.0 and
ActionScript 2.0. From Chapter 13 onward, the
client-side samples are written almost exclusively in ActionScript
2.0 and use the newer v2 Flash UI components. All server-side
FlashCom code is written in Server-Side ActionScript, which uses
ActionScript 1.0 syntax, because that is the only supported version.
Among the reasons for the mixture of ActionScript 1.0 (AS 1.0) and
ActionScript 2.0 (AS 2.0) throughout the book:
The communication classes provided for client-side scripting, such as
SharedObject, NetStream,
and NetConnection, were all designed to use AS
1.0-style dynamic methods and properties. In Chapter 13, I show how to wrap shared objects up so
that you can use AS 2.0, but that is an extra step and not something
provided by Macromedia. Macromedia's communication
components are available only in AS 1.0 and require the Flash UI
client-side v1 components. For example, the Chat
component's client-side code is written in AS 1.0
because the communication components were originally built for Flash
MX and have not been updated to AS 2.0. Server-Side ActionScript (SSAS) is JavaScript 1.5, which is very
close to AS 1.0. The client-side classes such as
SharedObject and
NetConnection also exist on the server where AS
1.0 must be used to do the same sort of work you must do on the
client such as setting up onStatus( ) or
onSync( ) event handlers. That is, it is much
easier to port client-side AS 1.0 code than AS 2.0 code to SSAS. ActionScript 2.0 is a superset of ActionScript 1.0. I think this is
something people coming from the Java world or just discovering the
discipline of strong typing, formal class and interface definitions,
and so on often forget. AS 2.0 code compiles down to the same
bytecode as AS 1.0, allowing AS 2.0 code to be exported for use in
Flash Player 6 (although Flash Player 6 doesn't
support all the latest AS 2.0 classes). Regardless, ActionScript
provides all the benefits of a simple scripting language, such as
loose typing and dynamic objects, while offering the option of
stronger typing and formal classes. AS 2.0 simply provides new
options that are particularly valuable for larger-scale projects. ActionScript 2.0 means different things to different developers. On
the syntactic level, it means support for strict typing and different
commands (such as import instead of
#include). On the architectural level, it includes
support for formal classes, packages, and interfaces. In the end, the
purpose of the book is to teach FlashCom programming, not
ActionScript 1.0 or 2.0. We didn't want to obscure
the basics of FlashCom programming with a heavy reliance on
object-oriented programming (OOP) and formal classes. This allows
scripters of all levels to focus on the new FlashCom material. Robust, deployment-ready code is not conducive to learning a topic.
The book often presents pared-down examples, but the web site has
full-blown code examples in both AS 1.0 and AS 2.0 format, when
appropriate.
 |