• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Preface > What's New in the Second Edition

What's New in the Second Edition

The second edition of ActionScript for Flash MX: The Definitive Guide is not merely a "tack-on" update to the first edition (which was titled ActionScript: The Definitive Guide). The entire text has been revised and restructured to highlight the latest Flash MX ActionScript features. Nearly every paragraph has been updated, and 400 pages have been added to cover ActionScript's new capabilities. Legacy descriptions of Flash 4 ActionScript syntax have been moved from the body of the book to Appendix C or online technotes. We made this choice to keep the book streamlined, although it is still considerably beefier than the first edition. By the time you read this, Flash Player 6 will be nearly ubiquitous, so it doesn't make sense to cover Flash 4 in detail anymore. We cover enough of it to help you understand and upgrade any legacy code you may own or encounter. We've also paid close attention to changes between Flash 5 and Flash 6 to help you understand the new paradigms and upgrade legacy code. The legacy code examples from the first edition will all remain available at http://www.moock.org/asdg/codedepot.

Updated Code Examples

All code examples from the first edition have been rewritten to use Flash MX syntax and best practices. For example:

  • The quiz samples now use callback functions — rather than Flash 5-style on( ) handlers — for button event handlers.

  • Text fields that were formerly drawn in the authoring tool are now generated programmatically with createTextField( ).

  • Classes are defined on _global (the new property that holds global variables)

  • The object-oriented LoadVars class is used instead of the older loadVariables( ) global function.

Likewise, dozens of new Flash MX-specific examples have been added. Here are just a few of the interesting ones:

  • A completely code-based, object-oriented quiz, downloadable from the online Code Depot (described later in The Code Depot)

  • A configurable text ticker (see TextField.hscroll)

  • An array-to-table converter (see TextFormat.tabStops)

  • A sound preloader (see Sound.getBytesLoaded( ))

Hundreds of Tweaks

Subtle details have been added throughout this book to augment the first edition's content. Here are just a few of the hundreds of tweaks made:

  • MovieClip._x discusses twips (the minimum distance a clip can be moved).

  • MovieClip._visible warns that button events don't fire when _visible is false.

  • XML.parseXML( ) covers CDATA and predefined XML entities (&, <, >, ", and ') at length.

  • MovieClip.getBytesLoaded( ) features a list of possible return values based on the asynchronous execution of loadMovie( ).

  • Chapter 2 discusses qualified and unqualified variable references and Hungarian notation.

  • Chapter 4 explicitly contrasts null with delete and undefined.

Of course, there are plenty of not-so-subtle changes too. We'll look at them next.

Major Revisions Since the First Edition

The following list describes the major content and structural changes in this second edition. Note that some of these chapters were in Part II, Applied ActionScript, in the first edition. Other material from the first edition's Part II was redistributed elsewhere in this second edition, and some content was moved to online technotes. Despite the organizational change, rest assured that this second edition includes dozens of applied examples sprinkled liberally throughout the entire book. The ActionScript Language Reference, formerly Part III in the first edition, is now Part II.

Chapter 1

  • Added an introduction to object-oriented programming

  • Revised the quiz tutorial for Flash MX

  • Revised the event handler section for Flash MX

Chapter 2

  • Added recommended suffixes for variable names

  • Added global variable coverage

  • Added a section on loading external variables

  • Added an explicit discussion of the scope chain

Chapter 3

Chapter 4

  • Added coverage of Unicode

Chapter 5

  • Added coverage of the strict equality and instanceof operators

Chapter 6

  • Added switch statement coverage

  • Revised the description of with to include the scope chain

  • Removed the legacy call statement (now covered in the ActionScript Language Reference only)

Chapter 8

  • Added a section on using setInterval( ) to execute code repeatedly

  • Revised "Timeline and Clip Event Loops" to use Flash MX features (MovieClip.createEmptyMovieClip( ) and the MovieClip.onEnterFrame( ) handler)

Chapter 9

  • Added a section on the differences between function literals and the function statement

  • Added coverage of nested functions

  • Revised "Function Scope" to cover lexical scope in more detail

  • Revised the quiz tutorial for Flash MX

Chapter 10

  • Added complete coverage of event handler properties

  • Added coverage of event listeners, new in Flash MX

  • Added an in-depth discussion of scope, including Table 10-1, which compares old scope rules to new scope rules

  • Added a description of the this keyword within various handlers, including a summary in Table 10-2

  • Moved all specific button and movie clip event descriptions to the ActionScript Language Reference (see also Table 10-3)

Chapter 11

  • Added coverage of the Array.sortOn( ) method

  • Revised the quiz tutorial for Flash MX

Chapter 12

  • Revised the chapter entirely to focus more squarely on the process of making a class with methods and properties

  • Added coverage of Flash MX's super keyword, used to invoke a superclass constructor and its methods

  • Added a formal discussion of the prototype chain

  • Added a formal discussion of issues with standard superclass assignment

  • Added a section on static methods and properties

  • Added a description of rendering an object to screen

  • Added an object-oriented programming (OOP) application template

  • Added an Section 12.9 section

  • Added a brief discussion of UML and design patterns

Chapter 13

  • Added information on creating a blank movie clip from scratch using MovieClip.createEmptyMovieClip( )

  • Added a section on drawing in a movie clip at runtime using the new Drawing API

  • Added a section on implementing button behavior for a movie clip

  • Added a section on handling input focus for movie clips

  • Revised (fixed) the first edition's partially erroneous description of MovieClip.duplicateMovieClip( ) depths

  • Moved the list of MovieClip methods and properties to the ActionScript Language Reference

  • Moved the legacy Tell Target discussion to Appendix C

  • Updated the clock example to use Flash MX best practices

  • Removed the quiz example, which is superseded by the new downloadable OOP quiz (the legacy version is still available online)

Chapter 14 (all new)

  • Covers how to make movie clip subclasses (specialized types of movie clip symbols associated with a class)

  • Covers how to create a basic component, of which the Flash UI Components are a complex example

Chapter 15 (previously Chapter 14)

Chapter 16

  • Revised the section on legacy Smart Clips to cover new Flash MX Components architecture instead

Chapter 17

  • Revised the code example and tutorial to use LoadVars class instead of loadVariables( )

Redistributed old Chapter 18, On-Screen Text Fields (in first edition only)

  • Contents of the entire chapter moved to the Language Reference (under TextField class) and to Appendix E (and augmented with substantial additions to the TextField class)

Removed old Chapter 19, Debugging (in first edition only)

Part II, Language Reference (formerly Part III)

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint