Chapter 15. Dynamic ActionScript

ActionScript was originally conceived of as a language for adding basic programmatic behavior to content created manually in the Flash authoring tool. In early versions of ActionScript, most code was intended to be written in short scripts that implemented limited functionality compared with the code required to create a complex desktop application. As such, ActionScript’s original feature set stressed flexibility and simplicity over formality and sophistication.

ActionScript originally allowed the structure of all classes and even all individual objects to be modified dynamically at runtime. For example, at runtime, a program could:

  • Add new instance methods or instance variables to any class

  • Add new instance methods or instance variables to any single, specific object

  • Create a new class entirely from scratch

  • Change a given class’s superclass

With the advent of ActionScript 3.0, Flash Player 9, Adobe AIR, and Flex, the Flash platform has evolved to a stage where the complexity of an ActionScript-based program may well rival the complexity of a full-featured desktop application. Accordingly, as a language, ActionScript has taken on many of the formal structures required for large-scale application development—structures such as a formal class keyword an inheritance syntax, formal datatypes, a built-in event framework, exception handling, and built-in XML support. Nevertheless, ActionScript’s dynamic features remain available in the language and still constitute ...

Get Essential ActionScript 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.