ActionScript: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 1: Line 1:
'''ActionScript''' is an [[ECMAScript]]-based programming language used for controlling [[Macromedia Flash]] movies and applications. Since both ActionScript and [[JavaScript]] are based on the same ECMAScript syntax, fluency in one easily translates to the other. However, where the client model of JavaScript deals with the structure of browser [[window]]s, documents and [[form (document)|form]]s, ActionScript deals with structure and interactivity of [[Macromedia Flash]] movies, which may include animations, audio, text and [[client-side]] logic.
'''ActionScript''' is an [[ECMAScript]]-based programming language used for controlling [[Macromedia Flash]] movies and applications. Since both ActionScript and [[JavaScript]] are based on the same ECMAScript syntax, fluency in one easily translates to the other. However, where the client model of JavaScript deals with the structure of browser [[window]]s, documents and [[form (document)|form]]s, ActionScript deals with the structure and interactivity of [[Macromedia Flash]] movies, which may include animations, audio, text and [[client-side]] logic.


ActionScript achieved something resembling its current syntax (retroactively named ActionScript 1.0) in Flash 5, the first version of Flash to be thoroughly programmable. Flash 6 broadened the power of the [[programming environment]] by adding many more built-in functions and allowing more programatic control of movie elements. Flash 7 (MX 2004) introduced ActionScript 2.0, which adds strong typing and [[object-oriented]] features such as explicit [[Class_(computer_science)|class]] declarations, [[Inheritance_(computer_science) | inheritance]], [[interfaces]], and [[Information_hiding|encapsulation]]. ActionScript 1.0 and 2.0 share the same compiled form within Flash SWFs.
ActionScript achieved something resembling its current syntax (retroactively named ActionScript 1.0) in Flash 5, the first version of Flash to be thoroughly programmable. Flash 6 broadened the power of the [[programming environment]] by adding many more built-in functions and allowing more programatic control of movie elements. Flash 7 (MX 2004) introduced ActionScript 2.0, which adds strong typing and [[object-oriented]] features such as explicit [[Class_(computer_science)|class]] declarations, [[Inheritance_(computer_science) | inheritance]], [[interfaces]], and [[Information_hiding|encapsulation]]. ActionScript 1.0 and 2.0 share the same compiled form within Flash SWFs.

Revision as of 01:12, 11 September 2005

ActionScript is an ECMAScript-based programming language used for controlling Macromedia Flash movies and applications. Since both ActionScript and JavaScript are based on the same ECMAScript syntax, fluency in one easily translates to the other. However, where the client model of JavaScript deals with the structure of browser windows, documents and forms, ActionScript deals with the structure and interactivity of Macromedia Flash movies, which may include animations, audio, text and client-side logic.

ActionScript achieved something resembling its current syntax (retroactively named ActionScript 1.0) in Flash 5, the first version of Flash to be thoroughly programmable. Flash 6 broadened the power of the programming environment by adding many more built-in functions and allowing more programatic control of movie elements. Flash 7 (MX 2004) introduced ActionScript 2.0, which adds strong typing and object-oriented features such as explicit class declarations, inheritance, interfaces, and encapsulation. ActionScript 1.0 and 2.0 share the same compiled form within Flash SWFs.

Features of the Flash ActionScript implementation that JavaScript programmers may find interesting:

  • Everything is designed to be asynchronous; callbacks are ubiquitous, but Event objects do not exist.
  • The XML implementation has been solid since Flash 5. Flash can send and receive XML asynchronously.

ActionScript code is frequently written directly in the Flash authoring environment, which offers reference and syntax highlighting. In this case, the source code is saved along with the rest of the movie in a .fla file. It is also common for ActionScript code to be imported from external text files via #include statements. In this case, the external files are often given .as extensions, but this is not a universal convention.

In ActionScript 2.0 there can be classes, and also, a library item (a movie clip) can be associated with a class. Classes are always written in external text files, and these files must have the .as extension.

The ActionScript 2.0 compiler is notoriously slow, often taking several minutes to compile around 100 classes.

History

  • Flash Player 2: First version with any scripting support, actions included gotoAndPlay, gotoAndStop, nextFrame and nextScene.
  • Flash Player 3: Expanded basic script support with the ability to load external SWFs (loadMovie).
  • Flash Player 4: First player with a full scripting implementation (called Actions). The scripting was a slash based syntax and contained support for loops, conditionals, variables and other basic language constructs.
  • Flash Player 6: Added an event handling model, and support for switch.
  • Flash Player 7: Flash Player 7 offered some new features such as CSS text and performance improvements. Macromedia Flash compilers released alongside Flash Player 7 also support ActionScript 2.0, a Class programming language based on the ECMAScript 4 Netscape Proposal. However, Actionscript 2.0 compiles down to ActionScript 1.0 byte-code, so it can be run by Flash Player 6.

External links

See Also