Filename extension: .as
Internet media type: application
Paradigm: Multi-paradigm: object-oriented (prototype-based), functional, imperative, scripting
Designed by: Gary Grossman
Developer: Macromedia (now dissolved into Adobe Systems)
Appeared in: 1998
Typing discipline: strong, static
OS: Cross-platform
Website: adobe
Major implementations: Adobe Flash Player, Adobe AIR, Apache Flex, Scaleform GFx
Influenced by: JavaScript, Java
ActionScript is a programming language used in client applications (such as Adobe Flash and Adobe Flex) and servers (Flash media server, JRun, Macromedia Generator).
ActionScript is a scripting language, object-oriented prototype, based on ECMAScript (100% compliant with the ECMA-262 standard, Revision 3, from ActionScript 3.0). ECMAScript is a standardized version of JavaScript, ActionScript and JavaScript, sharing a similar syntax.
The language used to add interactivity to Flash animations, responding to user actions, and directing the movie clip (graphic containers for prioritizing animations), and various multimedia objects (images, sound, video …). It also allows communication of application with the server, including by downloading files or communication with a server language like PHP.
Specific elements of language
ActionScript has evolved over time to become a real programming language applied to the multimedia/animation data management.
The declarations of variable in ActionScript is made with no annotation since version 3 (AS3), currently requiring to respect the syntax var nom_variable:nom_type. The assignment, which aims to set a variable, is possible.
Debugging the contents of a variable is made by using the “trace” function, and its removal with “delete”.
Comments are the same as those of the C99. We can comment the code in two ways:
-
comment on the end of the line with //
-
comment a block of rows with / * … * /
Like any programming language, ActionScript has control structures:
-
conditional branch: if, else;
-
loop: for, while.
Non compiled ActionScripts files have .as extension (used by the client) or .asr (used on the server). Compiled files have the extension .swf.
Components
The other big news of the ActionScript 2.0 is the introduction of components. These are compiled clips (the source is not necessarily provided) to which is associated a programming class. They are used as objects in their own right: their methods (functions applied to the object) may have graphic impacts.
Among the native components of Macromedia Flash (MX version 2004), one can find the equivalents of HTML “containers” (selection combos, text boxes, input, drop-down lists …), or more complex components such as windows, data tables, media players (sound, video). Most of these “natives” components are only available in the “Professional” version of Flash MX 2004.
Libraries
XML socket
One of ActionScript features, compared with other web languages, is to have built his library using the Socket API and XML files to transfer information between a server and Flash client automatically without action from the user. This allows the design of an application or a multi-user game in real time. It is then necessary to set up a server to “centralize” the information and redistribute it.
Ajax does not support socket connections and applications using Ajax technology (chat, im ..) asking the client to update periodically its GUI in a predefined frequency (pull mode, synchronous). By using sockets, refresh is done only if a new message is sent by the server, that is to say, in real time (push mode courier). The use of socket prevents the establishment of the management clients and storing information.
Compliant servers are often written in C ++ or Java and support easiest programming languages like PHP, Perl.
Graphic effects
ActionScript 2.0 has enabled the development over time of a library of graphic effects as components. Some addresses where some of these components are located:
- Adobe Add-ons: Filing components, including those known as “Flash Pro Featured Add-ons” .
ActionScript libraries
- Aslib: ActionScript library that implements conventional non-integrated data structures in the basic language (binary trees, linked lists, stacks, “hash table”).
- FP XHTML render: aXHTML parser. It displays the contents of an XHTML file in a Flash “container” (Window, etc.).
Leave a Reply