Content deleted Content added
m typo |
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5) (Eastmain - 23915 |
||
(42 intermediate revisions by 34 users not shown) | |||
Line 1:
{{Short description|Object-oriented programming language created for the Flash multimedia platform}}
{{for|the endpoint management interface|IBM BigFix#Action Script{{!}}IBM BigFix § Action Script}}
{{Use mdy dates|date=April 2013}}
{{Infobox programming language
| name
| logo
| paradigm
| family = [[ECMAScript]]
| designer
| developer
| released = {{Start date and age|1998}}
| latest release version = 3.0
| latest release date = {{Start date and age|2006|06|27}}
| typing
| implementations
| influenced_by = [[JavaScript]], [[Java (programming language)|Java]]▼
| scope = [[Scope (computer science)|lexical]]
▲|
| influenced = [[Haxe]], [[TypeScript]]<ref>{{Cite web |last=Nelson |first=Gary |date=28 April 2020 |title=How ActionScript foreshadowed TypeScript |url=https://javascript.plainenglish.io/how-actionscript-foreshadowed-typescript-149cdb764de9 |access-date=9 July 2022 |website=Medium |language=en}}</ref>
}}
{{Infobox file format
| name = ActionScript
| extension = .as
| mime = application/ecmascript<ref>{{IETF RFC|4329}} (limit compatible with
}}
'''ActionScript''' is an [[object-oriented programming]] language originally developed by [[Macromedia|Macromedia Inc.]] (later acquired by [[Adobe Systems]]). It is influenced by [[HyperTalk]], the scripting language for [[HyperCard]].<ref>{{cite web|url=http://www.zdnet.com/blog/government/apples-lost-decade-hypercard-and-what-might-not-have-been-if-apple-then-was-like-apple-is-today/10185|title=Apple's lost decade, HyperCard, and what might NOT have been if Apple then was like Apple is today|work=zdnet.com|date=2011-04-17|access-date=2014-12-04}}</ref> It is now an implementation of [[ECMAScript]] (meaning it is a superset of the syntax and semantics of the language more widely known as [[JavaScript]]), though it originally arose as a sibling, both being influenced by [[HyperTalk]]. ActionScript code is usually converted to byte-code format by the compiler. ▼
▲'''ActionScript''' is an [[
ActionScript is used primarily for the development of websites and software targeting the [[Adobe Flash]] platform, originally finding use on [[Web page]]s in the form of embedded [[SWF]] files.▼
▲ActionScript is used primarily for the development of websites and software targeting the [[Adobe Flash]] platform, originally finding use on [[
ActionScript 3 is also used with the [[Adobe AIR]] system for the development of desktop and mobile applications. The language itself is [[open-source]] in that its specification is offered free of charge<ref>{{Cite web |url=http://help.adobe.com/livedocs/specs/actionscript/3/wwhelp/wwhimpl/js/html/wwhelp.htm |title=ActionScript 3 Language Specification |access-date=November 12, 2016 |archive-url=https://web.archive.org/web/20170327122455/http://help.adobe.com/livedocs/specs/actionscript/3/wwhelp/wwhimpl/js/html/wwhelp.htm |archive-date=March 27, 2017 |url-status=dead |df=mdy-all
ActionScript was also used with [[Scaleform GFx]] for the development of
==Overview==
ActionScript was initially designed for controlling simple
Flash MX 2004 introduced ActionScript 2.0, a [[scripting language]] more suited to the development of Flash applications.
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 [[
Flash [[library (software)|libraries]] can be used with the XML
==History==
Line 44 ⟶ 47:
===Timeline by player version===
* '''Flash Player 2''': The first version with scripting support
* '''Flash Player 3''': Expanded basic scripting support,
* '''Flash Player 4''':
* '''Flash Player 5''': Included in the first version of ActionScript
* '''Flash Player 6'''
* '''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]] Proposal<ref>{{cite web|url=http://www.mozilla.org/js/language/es4.html |archive-url=https://web.archive.org/web/20070711065258/http://www.mozilla.org/js/language/es4.html |url-status=dead |archive-date=July 11, 2007 |title=ECMAScript 4 Netscape Proposal |publisher=[[Netscape]] |editor=Waldemar Horwat |date=June 30, 2003 |access-date=April 11, 2019
* '''Flash Player 8'''
* '''Flash Player 9 (initially called 8.5)'''
* '''Flash Player 10 (initially called Astro)''': Added basic [[3D computer graphics|3D]] manipulation, such as rotating on the X, Y, and Z axis, a 3D drawing API, and [[texture mapping]]. 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]]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.<ref>{{cite web|url=http://labs.adobe.com/technologies/flashplayer10/ |title=Adobe Labs – Adobe Flash Player 10.1 |publisher=Labs.adobe.com |access-date=December 17, 2009| archive-url= https://web.archive.org/web/20100105125609/http://labs.adobe.com/technologies/flashplayer10/| archive-date= January 5, 2010 | url-status= live}}</ref>
* '''Flash Player 11''': The major addition in this version are the [[Stage3D]]-based advanced (graphic card accelerated) 3D capabilities for Windows Desktop, Mac Desktop, [[iOS]], [[Android (operating system)|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]] support, [[Bézier curve|Cubic Bézier Curves]], a secure [[random number generator]], [[LZMA]] compression for
* '''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]] for Flash Player in [[Firefox]]. Frame label events. Support for compressing BitmapData to [[JPEG]] and [[PNG]] formats. Support for [[Mac OS X]] [[Mac App Store|App Store]] application sandboxing requirements. Text streaming support for Stage 3D. Expanded information about GPU [[device driver|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''':
* '''Flash Player 11.5''':
* '''Flash Player 11.6''':
* '''Flash Player 11.7''':
* '''Flash Player 11.8
===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.<ref>{{Cite web|url=https://helpx.adobe.com/x-productkb/multi/release-notes-flash-player-11.html|title=Flash Player 11, AIR 3 Release Notes|website=helpx.adobe.com|access-date=2016-10-07}}</ref> This was the first version of ActionScript with influences from [[JavaScript]] and the [[ECMA-262]] (Third Edition) standard, supporting the said standard's object model and many of its core [[data type]]s. Local variables may be declared with the {{Mono|var}} statement, and user-defined [[function (computer science)|functions]] with [[parameter (computer science)|parameter]] passing and [[return statement|return]] 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, [[Adobe Flash Player|Flash Player 6]], the language remained essentially unchanged; there were only minor changes, such as the addition of the {{Mono|switch}} statement and the "strict equality" ({{Mono|1====}}) 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 (
====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, [[Adobe Flash 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]] and class-based [[syntax of programming languages|syntax]], such as the keywords {{Mono|class}} and {{Mono|extends}}. While this allowed for a more structured object-oriented programming approach, the code would still be compiled to ActionScript 1.0 [[bytecode]], allowing it to be used on the preceding Flash Player 6 as well. In other words, the [[Class-based programming|class-based]] inheritance syntax was a layer on top of the existing prototype-based system. With ActionScript 2.0, developers could constrain [[variable (programming)|variables]] to a specific type by adding a type annotation so that type mismatch errors could be found at [[compile-time]]. 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 (programming language)|Java]] and [[C++]]. This version conformed partially to the [[ECMAScript]] Fourth Edition draft specification.
====2006–2020: ActionScript 3.0====
In June 2006, ActionScript 3.0 debuted with [[Adobe Flex|Adobe Flex 2.0]] and its corresponding player, [[Adobe Flash 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]]. 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]] ([[DirectX]], [[OpenGL]]).
The update to the language introduced several new features:
Line 88:
===Flash Lite===
* '''[[Flash Lite]] 1.0''': Flash Lite is the Flash technology specifically developed for mobile phones and consumer electronics devices.
* '''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.
Line 101:
===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
<syntaxhighlight lang="actionscript">
createTextField("greet", 0, 0, 0, 100, 100);
Line 126:
</syntaxhighlight>
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]] (IDE).
Presume the following file to be {{Mono|Greeter.as}}:
Line 141:
var txtHello: TextField = new TextField();
txtHello.text = "Hello World";
}
}
Line 148:
{{See also|Sprite (computer graphics)}}
ActionScript
<syntaxhighlight lang="mxml">
<?xml version="
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
Line 178:
'''ActionScript 2 top level data types'''
* '''
* '''Number'''
* '''Boolean'''
* '''Object''
'''ActionScript 2 complex data types'''
Line 187:
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'''
* '''TextField'''
* '''Button'''
* '''Date'''
* '''Array'''
* '''XML'''
* '''XMLNode'''
* '''LoadVars'''
* '''Sound'''
* '''NetStream'''
Line 201:
* '''EventListener'''
'''ActionScript 3 primitive (prime) data types'''<ref name="adobe1">{{cite web |url=http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000047.html |title=Data type descriptions + Flash CS3 Documentation |access-date=2007-07-13 |archive-url=https://web.archive.org/web/20071102191956/http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000047.html |archive-date=November 2, 2007 |df=mdy-all
* '''Boolean'''
* '''int'''
* '''Null'''
* '''Number'''
* '''String'''
* '''uint'''
* '''void'''
'''ActionScript 3 some complex data types'''<ref name="adobe1"/>
* '''Array'''
* '''Date'''
* '''Error'''
* '''flash.display:Bitmap'''
* '''flash.display:MovieClip'''
* '''flash.display:Shape'''
* '''flash.display:SimpleButton'''
* '''flash.display:Sprite'''
* '''flash.media:Video'''
* '''flash.text:TextField'''
* '''flash.utils:ByteArray'''
* '''flash.utils:Dictionary'''
* '''Function'''
* '''Object'''
* '''RegExp'''
* '''Vector'''
* '''XML'''
* '''XMLList'''
===Using data types===
Line 260:
// and the third (2) is an object with { a: 5, b: 7 }.
</syntaxhighlight>
Unlike some object-oriented languages, ActionScript makes no distinction between [[Primitive data type|primitive]] types and [[reference (computer science)|reference]] 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.<ref>{{cite web |url=http://livedocs.adobe.com/flex/3/html/03_Language_and_Syntax_19.html |title=Flex 3 – Function parameters |publisher=Livedocs.adobe.com |access-date=December 17, 2009 |archive-url=https://web.archive.org/web/20090212103954/http://livedocs.adobe.com/flex/3/html/03_Language_and_Syntax_19.html |archive-date=February 12, 2009 |url-status=dead |df=mdy-all
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.
Line 282:
// <node><child value="13" /></node>
</syntaxhighlight>
Only references to an object may be removed by using the "delete" keyword.
<syntaxhighlight lang="actionscript">
var item1: XML = new XML("<node><child /></node>");
Line 291:
==Code protection==
Like most [[bytecode]] file formats, Flash [[SWF]] files can be [[decompilation|decompiled]] into their source code and assets (similarly to how [[.NET Framework|Microsoft .NET]] files can be decompiled). Some decompilers are capable of nearly full reconstruction of the original source file,
In opposition to the decompilers, ActionScript [[obfuscated code|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.{{Citation needed|date=March 2021}}
==References==
{{Reflist
==External links==
Line 356 ⟶ 302:
{{Wikibooks|Introduction to ActionScript 2.0}}
{{Wikiversity|ActionScript:Introduction}}
*
* [http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=Part2_AS2_LangRef_1.html ActionScript 2.0 Language Reference] {{Webarchive|url=https://web.archive.org/web/20130131044759/http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=Part2_AS2_LangRef_1.html |date=January 31, 2013}}
* [http://help.adobe.com/en_US/AS3LCR/Flash_10.0/ ActionScript 3.0 Language & Component Reference]
** [http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/language-elements.html Language Elements]
Line 366 ⟶ 312:
* [https://web.archive.org/web/20100304105648/http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3/ Adobe Flex SDK]
* {{cite web |url=https://www.theverge.com/2017/7/25/16026236/adobe-flash-end-of-support-2020 |title=Adobe will finally kill Flash in 2020 |last=Warren |first=Tom |date=July 25, 2017 |website=The Verge |access-date=December 16, 2020 |archive-url=https://web.archive.org/web/20170725190530/https://www.theverge.com/2017/7/25/16026236/adobe-flash-end-of-support-2020 |archive-date=July 25, 2017 |url-status=live}}
{{Adobe Flash|state=uncollapsed}}
{{ECMAScript}}
Line 372 ⟶ 319:
{{DEFAULTSORT:Actionscript}}
[[Category:ActionScript| ]]
[[Category:Programming languages]]▼
[[Category:Adobe Flash]]
[[Category:Class-based programming languages]]
Line 380 ⟶ 326:
[[Category:1998 software]]
[[Category:High-level programming languages]]
[[Category:Programming languages compiled to bytecode]]
<!-- Hidden categories below -->
[[Category:Articles with example JavaScript code]]
|