ActionScript 2
   HOME

TheInfoList



OR:

ActionScript is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
originally developed by
Macromedia Macromedia, Inc. was an American graphics, multimedia, and web development software company headquartered in San Francisco, California, that made products such as Adobe Flash, Flash and Adobe Dreamweaver, Dreamweaver. It was purchased by its riv ...
Inc. (later acquired by
Adobe Adobe (from arabic: الطوب Attub ; ) is a building material made from earth and organic materials. is Spanish for mudbrick. In some English-speaking regions of Spanish heritage, such as the Southwestern United States, the term is use ...
). It is influenced by
HyperTalk HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk ...
, the scripting language for
HyperCard HyperCard is a application software, software application and software development kit, development kit for Apple Macintosh and Apple IIGS computers. It is among the first successful hypermedia systems predating the World Wide Web. HyperCard com ...
. It is now an implementation of
ECMAScript ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
(meaning it is a superset of the syntax and semantics of the language more widely known as
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
), though it originally arose as a sibling, both being influenced by HyperTalk. ActionScript code is usually converted to
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
format by a
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. ActionScript is used primarily for the development of websites and software targeting the
Adobe Flash Adobe Flash (formerly Macromedia Flash and FutureSplash) is a mostly discontinuedAlthough it is discontinued by Adobe Inc., for the Chinese market it is developed by Zhongcheng and for the international enterprise market it is developed by Ha ...
platform, originally finding use on
web page A web page (or webpage) is a World Wide Web, Web document that is accessed in a web browser. A website typically consists of many web pages hyperlink, linked together under a common domain name. The term "web page" is therefore a metaphor of pap ...
s in the form of embedded SWF files. ActionScript 3 is also used with the
Adobe AIR Adobe AIR (also known as Adobe Integrated Runtime and codenamed Apollo) is a cross-platform runtime system currently developed by Harman International, in collaboration with Adobe Inc., for building desktop applications and mobile application ...
system for the development of desktop and mobile applications. The language itself is
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
in that its specification is offered free of charge and both an open-source compiler (as part of
Apache Flex Apache Flex, formerly Adobe Flex, is a software development kit (SDK) for the development and deployment of cross-platform rich web applications based on the Adobe Flash platform. Initially developed by Macromedia and then acquired by Adobe System ...
) and open-source virtual machine (
Tamarin The tamarins are squirrel-sized New World monkeys from the family Callitrichidae in the genus ''Saguinus''. They are the first offshoot in the Callitrichidae tree, and therefore are the sister group of a clade formed by the lion tamarins, Go ...
) are available. ActionScript was also used with
Scaleform GFx Scaleform GFx is a discontinued game development middleware package, a vector graphics rendering engine used to display Adobe Flash-based user interfaces and HUDs for video games. In March 2011, Autodesk acquired Scaleform Corporation and Sca ...
for the development of three-dimensional video-game user interfaces and heads up displays.


Overview

ActionScript was initially designed for controlling simple two-dimensional
vector Vector most often refers to: * Euclidean vector, a quantity with a magnitude and a direction * Disease vector, an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematics a ...
animations made in Adobe Flash (formerly Macromedia Flash). Initially focused on animation, early versions of Flash content offered few interactivity features, thus had very limited scripting ability. Later versions added functionality allowing for the creation of web-based games and
rich web application A Rich Internet Application (also known as a rich web application, RIA or installable Internet application) is a web application that has many of the characteristics of desktop application software. The concept is closely related to a single-pag ...
s with streaming media (such as video and audio). Today, ActionScript is suitable for desktop and mobile development through Adobe AIR; it is used in some database applications and in basic robotics as in
Make Controller Kit ''Make'' (stylized as ''Make:'' or ''MAKE:'') is an American magazine published since February 2005 which focuses on do it yourself (DIY) projects for individuals and groups, involving computers, electronics, metalworking, robotics, woodworking a ...
. Flash MX 2004 introduced ActionScript 2.0, a
scripting language In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
more suited to the development of Flash applications. Saving time is often possible by scripting something rather than animating it, which usually also enables a higher level of flexibility when editing. Since the arrival of the Flash Player 9 alpha (in 2006), a newer version of ActionScript has been released, ActionScript 3.0. This version of the language is intended to be compiled and run on a version of the
Tamarin The tamarins are squirrel-sized New World monkeys from the family Callitrichidae in the genus ''Saguinus''. They are the first offshoot in the Callitrichidae tree, and therefore are the sister group of a clade formed by the lion tamarins, Go ...
virtual machine, formerly ActionScript Virtual Machine 2, that was also fully rewritten (dubbed AVM2). Because of this, code written in ActionScript 3.0 is generally targeted for Flash Player 9 and higher, and will not work in prior versions. At the same time, ActionScript 3.0 executes up to 10 times faster than legacy ActionScript code due to the
just-in-time compiler In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is compiler, compilation (of Source code, computer code) during execution of a program (at run time (program lifecycle phase), run time) rather than b ...
enhancements. Flash
libraries A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
can be used with the XML abilities of the browser to render rich content in the browser. This technology is known as Asynchronous Flash and XML, much like AJAX. Adobe offers its Flex product line to meet the demand for rich web applications built on the Flash runtime, with behaviors and programming done in ActionScript. ActionScript 3.0 forms the foundation of the Flex 2 application programming interface (
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
).


History

ActionScript started as an
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
language for
Macromedia Macromedia, Inc. was an American graphics, multimedia, and web development software company headquartered in San Francisco, California, that made products such as Adobe Flash, Flash and Adobe Dreamweaver, Dreamweaver. It was purchased by its riv ...
's Flash authoring tool, later developed by Adobe Systems as Adobe Flash. The first three versions of the Flash authoring tool provided limited interactivity features. Early Flash developers could attach a simple command, called an "action", to a button or a frame. The set of actions was basic navigation controls, with commands such as "play", "stop", "getURL", and "gotoAndPlay". With the release of Flash 4 in 1999, this simple set of actions became a small scripting language. New capabilities introduced for Flash 4 included
variables Variable may refer to: Computer science * Variable (computer science), a symbolic name associated with a value and whose associated value may be changed Mathematics * Variable (mathematics), a symbol that represents a quantity in a mathemat ...
, expressions,
operators Operator may refer to: Mathematics * A symbol indicating a mathematical operation * Logical operator or logical connective in mathematical logic * Operator (mathematics), mapping that acts on elements of a space to produce elements of another ...
, if statements, and loops. Although referred to internally as "ActionScript", the Flash 4 user manual and marketing documents continued to use the term "actions" to describe this set of commands.


Timeline by player version

* Flash Player 2: The first version with scripting support, its actions included gotoAndPlay, gotoAndStop, nextFrame and nextScene for timeline control. * Flash Player 3: Expanded basic scripting support, it has the ability to load external SWFs (loadMovie). * Flash Player 4: The first player with a full scripting implementation (called ''Actions''), the scripting was a Flash-based syntax and contained support for loops, conditionals, variables, and other basic language constructs. * Flash Player 5: Included in the first version of ActionScript, it used
prototype-based programming Prototype-based programming is a style of object-oriented programming in which behavior reuse (known as inheritance) is performed via a process of reusing existing objects that serve as prototypes. This model can also be known as ''prototypal'', ...
based on ECMAScript, and allowed full
procedural programming Procedural programming is a programming paradigm, classified as imperative programming, that involves implementing the behavior of a computer program as Function (computer programming), procedures (a.k.a. functions, subroutines) that call each o ...
and object-oriented programming. Design based development. * Flash Player 6 added an event-handling model, accessibility controls, and support for
switch In electrical engineering, a switch is an electrical component that can disconnect or connect the conducting path in an electrical circuit, interrupting the electric current or diverting it from one conductor to another. The most common type o ...
. The first version with support for the
Action Message Format Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. T ...
(AMF) and Real-Time Messaging Protocol (RTMP) allowed for on demand audio/video streaming. * Flash Player 7: Additions to it include Cascading Style Sheets ( CSS) styling for text and support for ActionScript 2.0, a programming language based on the ECMAScript 4
Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California, and then Dulles, Virginia. Its Netscape web browser was o ...
Proposal with
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
-based
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offi ...
. However, ActionScript 2.0 can cross compile to ActionScript 1.0
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
, so that it can run in Flash Player 6. * Flash Player 8 further extended ActionScript 1/ActionScript 2 by adding new class libraries with APIs for controlling bitmap data at run-time, file uploads, and live filters for blur and
drop shadow In graphic design and computer graphics, a drop shadow is a visual effect consisting of a drawing element which looks like the shadow of an object, giving the impression that the object is raised above the objects behind it. The drop shadow is of ...
. * Flash Player 9 (initially called 8.5) added ActionScript 3.0 with the advent of a new virtual machine, called ActionScript Virtual Machine 2 (AVM2), which coexists with the previous AVM1 needed to support legacy content. Performance increases were a major objective for this release of the player, including a new just-in-time (JIT) compiler. Support for binary sockets,
ECMAScript for XML ECMAScript for XML (E4X) was an extension to ECMAScript (which includes ActionScript, JavaScript, and JScript) to add native support for XML. The goal was to provide a simpler alternative to the DOM interface for accessing XML documents. E4X added ...
(E4X) XML parsing, full-screen mode, and regular expressions were added. This is the first release of the player to be titled Adobe Flash Player. * Flash Player 10 (initially called Astro): Added basic 3D manipulation, such as rotating on the X, Y, and Z axis, a 3D drawing API, and
texture mapping Texture mapping is a term used in computer graphics to describe how 2D images are projected onto 3D models. The most common variant is the UV unwrap, which can be described as an inverse paper cutout, where the surfaces of a 3D model are cut ap ...
. Ability to create custom filters using Adobe Pixel Bender. Several visual processing tasks are now offloaded to the GPU which gives a noticeable decrease to rendering time for each frame, resulting in higher
frame rate Frame rate, most commonly expressed in frame/s, or FPS, is typically the frequency (rate) at which consecutive images (Film frame, frames) are captured or displayed. This definition applies to film and video cameras, computer animation, and moti ...
s, especially with H.264 video. There is a new sound API which allows for custom creation of audio in flash, something that has never been possible before. Furthermore, Flash Player 10 supports Peer to Peer ( P2P) communication with Real Time Media Flow Protocol (RTMFP). * Flash Player 11: The major addition in this version are the
Stage3D Stage3D (codenamed ''Molehill'') is an Adobe Flash Player API for rendering interactive 3D graphics with GPU-acceleration, within Flash games and applications. Flash Player or AIR applications written in ActionScript 3 may use Stage3D to render ...
-based advanced (graphic card accelerated) 3D capabilities for Windows Desktop, Mac Desktop,
iOS Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
, Android, and other major platforms. Significant compatibility improvements have been added for the iOS platform, and other non-desktop platforms. Other features include H.264 encoding for cameras, Native
JSON JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
support, Cubic Bézier Curves, a secure
random number generator Random number generation is a process by which, often by means of a random number generator (RNG), a sequence of numbers or symbols is generated that cannot be reasonably predicted better than by random chance. This means that the particular ou ...
, LZMA compression for SWF files, workers to offload some code execution to other processor threads, graphics card accelerated camera feed rendering, memory intrinsics and performance analysis, and the ActionScript Compiler 2.0, as well as some other minor additions. * Flash Player 11.2: released in March 2012, focused on adding features that are key for the gaming and video markets. Some of the features in the release include the following: Mouse-lock support. Right and middle mouse-click support. Context menu disabling. Hardware-accelerated graphics/Stage 3D support for Apple iOS and Android via Adobe AIR. Support for more hardware accelerated video cards (from January 2008) in order to expand availability of hardware-accelerated content. New Throttle event API (dispatches event when Flash Player throttles, pauses, or resumes content). Multithreaded video decoding pipeline on PCs, which improves overall performance of video on all desktop platforms. Notification of use of premium features in the debug players; content runs unrestricted in the release players. * Flash Player 11.3: released in June 2012, focused on enabling features and functionality key for the gaming market, as well as addressing popular feature requests from developers. Some of the features in this release include the following: Keyboard input support in full-screen mode. Improved audio support for working with low-latency audio. Ability to progressively stream textures for Stage 3D content.
Protected mode In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units (CPUs). It allows system software to use features such as Memory_segmentation, segmentation, virtual mem ...
for Flash Player in
Firefox Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements curr ...
. Frame label events. Support for compressing BitmapData to
JPEG JPEG ( , short for Joint Photographic Experts Group and sometimes retroactively referred to as JPEG 1) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degr ...
and PNG formats. Support for
Mac OS X macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
App Store An app store, also called an app marketplace or app catalog, is a type of digital distribution platform for computer software called applications, often in a mobile context. Apps provide a specific set of functions which, by definition, do not i ...
application sandboxing requirements. Text streaming support for Stage 3D. Expanded information about GPU driver details. Bitmap draw with quality API (new). Release outside mouse event API. Flash Player silent update support for Mac OS. Stylus support for Android 4.0 devices (Adobe AIR). USB debugging for iOS (Adobe AIR). iOS simulator support (Adobe AIR). * Flash Player 11.4: Released in August 2012, it focused on enabling features and functionality that are key for the gaming market, as well as addressing popular feature requests from developers. Some of the features in this release include ActionScript workers (enables concurrent ActionScript execution on separate threads), support for advanced profiling, LZMA compression support for ByteArray, support for hardware-accelerated video cards for Stage 3D expanded to 2006, improved ActionScript performance when targeting Apple iOS, performance index API to inform about performance capabilities of current environment, support for compressed textures with alpha support, support for StageVideo.attachCamera API, and support for push notifications for iOS (Adobe AIR). * Flash Player 11.5: Released in November 2012, it focused on performance improvement and stability. Some of the features in this release include shared ByteArray support for ActionScript workers, debug
stack trace In computing, a stack trace (also called stack backtrace or stack traceback) is a report of the active stack frames at a certain point in time during the execution of a program. When a program is run, memory is often dynamically allocated in tw ...
in release builds of Flash Player, and various bug fixes. * Flash Player 11.6: Released in March 2013, it focuses on performance improvements, security enhancements, and stability. Some of the features in this release include ability to query graphics vector data at runtime, full-screen permission dialog user interface improvements, ability to load SWFs at runtime when deploying as an AIR application in AOT mode on iOS, finer-grained control over supported display resolution on iOS devices when deploying as an AIR application, HiDPI support for Flash Professional, and ActionScript 3 access to fast memory operations/intrinsics. * Flash Player 11.7: Released in June 2013, code-named "Geary", this release focuses on premium video, gaming, security, and stability. Some of the features planned for this release include Android captive runtime debugging, support for the
OUYA The Ouya ( ), stylized as OUYA, is an Android (operating system), Android-based microconsole developed by Ouya Inc. Julie Uhrman founded the project in 2012, bringing in designer Yves Béhar to collaborate on its design and Muffi Ghadiali as VP ...
controller, remote hosting of SWF files on iOS, and preventing backup of shared objects on iOS for better iCloud support. * Flash Player 11.8: Adobe was planning to release this version in the early part of the second half of 2013, code-named "Harrison". This release focused on premium video, gaming, security, and stability. Some of the features in this release would have included recursive stop API on MovieClips and GamePad support on desktop browsers and Android.


Timeline by ActionScript version


2000–2004: ActionScript "1.0"

With the release of Flash 5 in September 2000, the "actions" from Flash 4 were enhanced once more and named "ActionScript" for the first time. This was the first version of ActionScript with influences from
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
and the ECMA-262 (Third Edition) standard, supporting the said standard's object model and many of its core
data type In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
s. Local variables may be declared with the statement, and user-defined functions with
parameter A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
passing and
return Return may refer to: In business, economics, and finance * Return on investment (ROI), the financial gain after an expense. * Rate of return, the financial term for the profit or loss derived from an investment * Tax return, a blank document or t ...
values can also be created. Notably, ActionScript could now also be typed with a text editor rather than being assembled by choosing actions from drop-down lists and dialog box controls. With the next release of its authoring tool, Flash MX, and its corresponding player, Flash Player 6, the language remained essentially unchanged; there were only minor changes, such as the addition of the statement and the "strict equality" () operator, which brought it closer to being ECMA-262-compliant. Two important features of ActionScript that distinguish it from later versions are its loose type system and its reliance on prototype-based
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offi ...
. Loose typing refers to the ability of a variable to hold any type of data. This allows for rapid script development and is particularly well-suited for small-scale scripting projects. Prototype-based inheritance is the ActionScript 1.0 mechanism for code reuse and object-oriented programming. Instead of a keyword that defines common characteristics of a
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
, ActionScript 1.0 uses a special object that serves as a "prototype" for a class of objects. All common characteristics of a class are defined in the class's prototype object and every instance of that class contains a link to that prototype object.


2003–2006: ActionScript 2.0

The next major revision of the language, ActionScript 2.0, was introduced in September 2003 with the release of Flash MX 2004 and its corresponding player, Flash Player 7. In response to user demand for a language better equipped for larger and more complex applications, ActionScript 2.0 featured compile-time
type checking In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
and class-based
syntax In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
, such as the keywords and . While this allowed for a more structured object-oriented programming approach, the code would still be compiled to ActionScript 1.0
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
, allowing it to be used on the preceding Flash Player 6 as well. In other words, the
class-based Class-based programming, or more commonly class-orientation, is a style of object-oriented programming (OOP) in which inheritance occurs via defining ''classes'' of objects, instead of inheritance occurring via the objects alone (compare prototyp ...
inheritance syntax was a layer on top of the existing prototype-based system. With ActionScript 2.0, developers could constrain
variables Variable may refer to: Computer science * Variable (computer science), a symbolic name associated with a value and whose associated value may be changed Mathematics * Variable (mathematics), a symbol that represents a quantity in a mathemat ...
to a specific type by adding a type annotation so that type mismatch errors could be found at
compile-time In computer science, compile time (or compile-time) describes the time window during which a language's statements are converted into binary instructions for the processor to execute. The term is used as an adjective to describe concepts relat ...
. ActionScript 2.0 also introduced class-based inheritance syntax so that developers could create classes and interfaces, much as they would in class-based languages such as
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
and C++. This version conformed partially to the
ECMAScript ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
Fourth Edition draft specification.


2006–2020: ActionScript 3.0

In June 2006, ActionScript 3.0 debuted with Adobe Flex 2.0 and its corresponding player, Flash Player 9. ActionScript 3.0 was a fundamental restructuring of the language, so much so that it uses an entirely different
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
. Flash Player 9 contains two virtual machines, AVM1 for code written in ActionScript 1.0 and 2.0, and AVM2 for content written in ActionScript 3.0. ActionScript 3.0 added limited support for
hardware acceleration Hardware acceleration is the use of computer hardware designed to perform specific functions more efficiently when compared to software running on a general-purpose central processing unit (CPU). Any transformation of data that can be calcula ...
(
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct" ...
,
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
). The update to the language introduced several new features: *
Compile-time In computer science, compile time (or compile-time) describes the time window during which a language's statements are converted into binary instructions for the processor to execute. The term is used as an adjective to describe concepts relat ...
and run-time type checking—type information exists at both compile-time and runtime. * Improved performance from a class-based inheritance system separate from the prototype-based inheritance system. * Support for packages,
namespace In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified. Namespaces ...
s, and
regular expressions A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of character (computing), characters that specifies a pattern matching, match pattern in string (computer science), text. Usually ...
. * Compiles to an entirely new type of
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
, incompatible with ActionScript 1.0 and 2.0 bytecode. * Revised Flash Player
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
, organized into packages. * Unified
event handling In computing, an event is a detectable occurrence or change in the system's state, such as user input, hardware interrupts, system notifications, or changes in data or conditions, that the system is designed to monitor. Events trigger responses or ...
system based on the DOM event handling standard. * Integration of
ECMAScript for XML ECMAScript for XML (E4X) was an extension to ECMAScript (which includes ActionScript, JavaScript, and JScript) to add native support for XML. The goal was to provide a simpler alternative to the DOM interface for accessing XML documents. E4X added ...
(E4X) for purposes of
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
processing. * Direct access to the Flash runtime display list for complete control of what gets displayed at runtime. * Completely conforming implementation of the
ECMAScript ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
fourth edition draft specification. * Limited support for dynamic 3D objects. (X, Y, Z rotation, and texture mapping)


Flash Lite

* Flash Lite 1.0: Flash Lite is the Flash technology specifically developed for mobile phones and consumer electronics devices. Supports Flash 4 ActionScript. * Flash Lite 1.1: Flash 4 ActionScript support and additional device APIs added. * Flash Lite 2.0 and 2.1: Added support for Flash 7 ActionScript 2.0 and some additional fscommand2 API. * Flash Lite 3: Added support for Flash 8 ActionScript 2.0 and also FLV video playback. * Flash Lite 4: Added support for Flash 10 ActionScript 3.0 as a browser plugin and also hardware graphics acceleration.


AIR

Adobe AIR Adobe AIR (also known as Adobe Integrated Runtime and codenamed Apollo) is a cross-platform runtime system currently developed by Harman International, in collaboration with Adobe Inc., for building desktop applications and mobile application ...
supports ActionScript, in addition to some extended contents, such as the Stage3D engine Adobe has developed. The number of
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
s (Application programming interfaces) available to ActionScript 3.0 has also risen dramatically.


Syntax

ActionScript code is free form and thus may be created with whichever amount or style of whitespace that the author desires. The basic syntax is derived from
ECMAScript ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
.


ActionScript 2.0

The following code, which works in any compliant player, creates a text field at depth 0, at position (0, 0) on the screen (measured in
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a Raster graphics, raster image, or the smallest addressable element in a dot matrix display device. In most digital display devices, p ...
s), that is 100 pixels wide and high. Then the text parameter is set to the ""
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
, and it is automatically displayed in the player: createTextField("greet", 0, 0, 0, 100, 100); greet.text = "Hello, world"; When writing external ActionScript 2.0 class files the above example could be written in a file named as following. class com.example.Greeter extends MovieClip


ActionScript 3.0

ActionScript 3.0 has a similar syntax to ActionScript 2.0, but a different set of APIs for creating objects. Compare the script below to the previous ActionScript 2.0 version: var txtHello: TextField = new TextField(); txtHello.text = "Hello World"; this.addChild(txtHello); Minimal ActionScript 3.0 programs may be somewhat larger and more complicated due to the increased separation of the programming language and the Flash
integrated development environment An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
(IDE). Presume the following file to be : package com.example ActionScript 3 can also be used in
MXML MXML is an XML-based user interface markup language first introduced by Macromedia in March 2004. Application developers use MXML in combination with ActionScript to develop rich web applications, with products such as Apache Flex. Adobe Syst ...
files when using Apache's Flex framework: DATA[ public function initApp(): void >


Data structures


Data types

ActionScript primarily consists of "fundamental" or "simple" data types that are used to create other data types. These data types are very similar to
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
data types. Since ActionScript 3 was a complete rewrite of ActionScript 2, the data types and their inheritances have changed. ActionScript 2 top level data types * String: A list of characters such as "Hello World" * Number: Any Numeric value * Boolean: A simple binary storage that can only be "true" or "false". * Object: Object is the data type all complex data types inherit from. It allows for the grouping of methods, functions, parameters, and other objects. ActionScript 2 complex data types There are additional "complex" data types. These are more processor and memory intensive and consist of many "simple" data types. For AS2, some of these data types are: * MovieClip: An ActionScript creation that allows easy usage of visible objects. * TextField: A simple dynamic or input text field. Inherits the MovieClip type. * Button: A simple button with 4 frames (states): Up, Over, Down and Hit. Inherits the MovieClip type. * Date: Allows access to information about a specific point in time. * Array: Allows linear storage of data. * XML: An XML object * XMLNode: An XML node * LoadVars: A Load Variables object allows for the storing and send of HTTP POST and HTTP GET variables * Sound * NetStream * NetConnection * MovieClipLoader * EventListener ActionScript 3 primitive (prime) data types * Boolean: The Boolean data type has only two possible values: true and false or 1 and 0. No other values are valid. * int: The int data type is a 32-bit integer between -2,147,483,648 and 2,147,483,647. * Null: The Null data type contains only one value, null. This is the default value for the String data type and all classes that define complex data types, including the Object class. * Number: The Number data type can represent integers, unsigned integers, and
floating-point In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
numbers. The Number data type uses the 64-bit double-precision format as specified by the
IEEE The Institute of Electrical and Electronics Engineers (IEEE) is an American 501(c)(3) organization, 501(c)(3) public charity professional organization for electrical engineering, electronics engineering, and other related disciplines. The IEEE ...
Standard for Binary Floating-Point Arithmetic ( IEEE-754). The Number type can store integers between -9,007,199,254,740,992 (-253) to 9,007,199,254,740,992 (253), and floating-point values between Number.MAX_VALUE (1.79769313486231e+308) and Number.MIN_VALUE (4.940656458412467e-324). * String: The String data type represents a sequence of 16-bit characters. Strings are stored internally as Unicode characters, using the
UTF-16 UTF-16 (16-bit Unicode Transformation Format) is a character encoding that supports all 1,112,064 valid code points of Unicode. The encoding is variable-length as code points are encoded with one or two ''code units''. UTF-16 arose from an earli ...
format. Previous versions of Flash used the UTF-8 format. * uint: The uint (unsigned integer) data type is a 32-bit unsigned integer between 0 and 4,294,967,295. * void: The void data type contains only one value, undefined. In previous versions of ActionScript, undefined was the default value for instances of the Object class. In ActionScript 3.0, the default value for Object instances is null. ActionScript 3 some complex data types * Array: Contains a list of data. Though ActionScript 3 is a strongly typed language, the contents of an Array may be of any type and values must be cast back to their original type after retrieval (support for typed Arrays has recently been added with the Vector class). * Date: A date object containing the date/time digital representation. * Error: A generic error object that allows runtime error reporting when thrown as an exception. * flash.display:Bitmap: A non-animated bitmap display object. * flash.display:MovieClip: Animated movie clip display object; Flash timeline is, by default, a MovieClip. * flash.display:Shape: A non-animated vector shape object. * flash.display:SimpleButton: A simple interactive button type supporting "up", "over", and "down" states with an arbitrary hit area. * flash.display:Sprite: A display object container without a timeline. * flash.media:Video: A video playback object supporting direct (progressive download) or streaming (RTMP) transports. As of Flash Player version 9.0.115.0, the H.264/MP4 high-definition video format is also supported alongside standard Flash video (FLV) content. * flash.text:TextField: A dynamic, optionally interactive text field object. * flash.utils:ByteArray: Contains an array of binary byte data. * flash.utils:Dictionary: Dictionaries are a variant of Object that may contain keys of any data type (whereas Object always uses strings for its keys). * Function: The core class for all Flash method definitions. * Object: The Object data type is defined by the Object class. The Object class serves as the base class for all class definitions in ActionScript. Objects in their basic form can be used as
associative array In computer science, an associative array, key-value store, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In math ...
s that contain key-value pairs, where keys are Strings and values may be any type. * RegExp: A regular expression object for strings. * Vector: A variant of array supported when publishing for Flash Player 10 or above. Vectors are typed, dense Arrays (values must be defined or null) which may be fixed-length, and are bounds-checked during retrieval. Vectors are not just more typesafe than Arrays but also perform faster. * XML: A revised XML object based on the E4X (Standard ECMA-357); nodes and attributes are accessed differently from ActionScript 2.0 object (a legacy class named XMLDocument is provided for backwards compatibility). * XMLList: An array-based object for various content lookups in the XML class.


Using data types

The basic syntax is: var variableName: VariableType = new VariableType(param1, param2, ..., paramN); So in order to make an empty Object: var myObject: Object = new Object(); Or, in an informal way: var myObject = ; Some types are automatically put in place: var myString: String = "Hello Wikipedia!"; // This would automatically set the variable as a string. var myNumber: Number = 5; // This would do the same for a number. var myObject: Object = ; // This creates an object with two variables. // param1 is a string with the data of "Hi!", // and param2 is a number with the data of 76. // This is the syntax for automatically creating an Array. var myArray: Array = , "Hello!", // It creates an Array with 3 variables. // The first (0) is a number with the value of 5, // the second (1) is a string with the value of "Hello!", // and the third (2) is an object with . Unlike some object-oriented languages, ActionScript makes no distinction between primitive types and
reference A reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''nam ...
types. In ActionScript, all variables are reference types. However, objects that belong to the primitive data types, which includes Boolean, Number, int, uint, and String, are immutable. So if a variable of a supposedly primitive type, e.g. an integer is passed to a function, altering that variable inside the function will not alter the original variable, as a new int Object is created when inside the function. If a variable of another (not primitive) datatype, e.g. XML is passed to a function, altering that variable inside the function will alter the original variable as well, as no new XML Object is created. Some data types can be assigned values with literals: var item1: String = "ABC"; var item2: Boolean = true; var item3: Number = 12; var item4: Array = a", "b", "c" var item5: Object = ; var item6: XML = ; // Note that the primitive XML is not quoted A reference in ActionScript is a pointer to an instance of a class. A reference stores the memory address of an object – operations against references will follow the value of the reference to the memory address of the object and carry out the operation on that object. All objects in ActionScript are accessed through references instead of being accessed directly. var item1: XML = new XML(""); var item2: XML = item1; item2.firstChild.attributes.value = 13; // item1 now equals item2 since item2 simply points to what item1 points to. // Both are now: // Only references to an object may be removed by using the "delete" keyword. Removal of actual objects and data is done by the Flash Player garbage collector which checks for any existing references in the Flash memory space. If none are found (no other reference is made to the orphaned object), it is removed from memory. For this reason, memory management in ActionScript requires careful application development planning. var item1: XML = new XML(""); delete item1; // If no other reference to item1 is present anywhere else in the application, // it will be removed on the garbage collector's next pass


Code protection

Like most
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
file formats, Flash SWF files can be decompiled into their source code and assets (similarly to how
Microsoft .NET The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995". In support of this strategy, between 2000 an ...
files can be decompiled). Some decompilers are capable of nearly full reconstruction of the original source file, approximate to the actual code that was used during creation (although results vary on a case-by-case basis).Customer comments on another Flash product
In opposition to the decompilers, ActionScript obfuscators have been introduced, which transform code into a form that breaks decompiler output while preserving the functionality and structure of the program. Higher-quality obfuscators implement lexical transformations such as identifier renaming, control flow transformation, and data abstraction transformation which collectively make it harder for decompilers to generate output likely to be useful to a human. Less robust obfuscators insert traps for decompilers. Such obfuscators either cause the decompiler software to crash unexpectedly or to generate unintelligible source code.


References


External links

* , ActionScript Technology Center
ActionScript 2.0 Language Reference

ActionScript 3.0 Language & Component Reference
*

*

*


Flex 3 LiveDocs: Programming ActionScript 3.0

Adobe – Flash Developer Center

Adobe Flex SDK
* {{DEFAULTSORT:Actionscript Adobe Flash Class-based programming languages JavaScript programming language family Scripting languages Programming languages created in 1998 1998 software High-level programming languages Programming languages compiled to bytecode Articles with example JavaScript code Statically typed programming languages