
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
ActionScript 1.0 and 2.0 in Flash Player 6 and 7
|
9
compile to the same .swf bytecode (with a few minor additions for ActionScript 2.0).
To the Flash Player, at runtime, there’s effectively no difference between ActionScript
1.0 and ActionScript 2.0 (barring the aforementioned minor additions). For example,
once an ActionScript 2.0 class, such as Rectangle, is compiled to a .swf file, it exists as
a Function object at runtime, just as an older ActionScript 1.0 function declaration
used as a class constructor would. Similarly, at runtime, an ActionScript 2.0 Rectangle
instance (
r) is given a __proto__ property that refers to Rectangle.prototype, again
making it look to the Flash Player just like its ActionScript 1.0 counterpart.
But for the most part, you don’t need to worry about these behind-the-scenes com-
piler and runtime issues. If you’re moving to ActionScript 2.0 (and I think you
should!), you can permanently forget ActionScript 1.0’s prototype-based program-
ming. In fact, most ActionScript 1.0 techniques for dynamically manipulating objects
and classes at runtime are considered bad practice in ActionScript 2.0, and will actu-
ally lead to compiler errors when mixed with ActionScript 2.0 code. But never fear,
this book highlights problematic ActionScript 1.0 practices and show ...