ActionScript

ImprimirCitar

Adobe ActionScript (released 1997) is the programming language for the Adobe Flash platform. Originally developed as a way for developers to program more interactively. Programming with ActionScript allows much more efficiency in Flash Platform applications to build animations of all kinds, from simple to complex, data-rich, and interactive interfaces.

The most widespread version currently is Action Script 3.0, which meant an improvement in the handling of object-oriented programming by better adjusting to the ECMA-262 standard and is used in the latest versions of Adobe Flash and Flex and in previous versions of flex. Since version 2 of Flex, ActionScript 3 has been included, which improves its performance compared to its predecessors, as well as including new features such as the use of regular expressions and new ways of packaging classes.

Structure

Flash is composed of objects, with their respective path within the swf. Each of these in ActionScript belongs to a class (MovieClip, buttons, Vectors (Arrays), etc.), which contains Properties and Methods or Functions.

  • Properties: Within the root file of the class, they are declared as variables (alpha, useHandCursor, length,...).
  • Methods or Functions: Within the root file of the class, they are declared as functions (stop(), gooAndPlay(), getURL(),...).

Types

Some ActionScript classes are:

  • Accessibility (high level)
  • Array (instances)
  • Boolean (instances)
  • Button (instances)
  • Capabilities (high level)
  • Color (instances)
  • ContextMenu (instances)
  • ContextMenuItems (instances)
  • Date (instances)
  • Error (instances)
  • Key (top level)
  • LoadVars (instances)
  • Math (higher level)
  • Mouse (high level)
  • MovieClip (instances)
  • MovieClipLoader (instances)
  • NetConnection (instances)
  • NetStream (instances)
  • Number (high level)
  • Object (instances)
  • PrintJob (instances)
  • Selection (high level)
  • Sound (instances)
  • Stage (higher level)
  • String (instances)
  • StyleSheet (instances)
  • System (high level)
  • TextField (instances)
  • TextFormat (instances)
  • XML (in substance)
  • XMLSocket

ActionScript 3.0

ActionScript 3.0 offers a robust programming model that is familiar to developers with a basic understanding of object-oriented programming. Some of the main features of ActionScript 3.0 are:

  • A new ActionScript virtual machine, called AVM2, which uses a new set of bytes code instructions and provides important performance improvements.
  • A more modern compiler code base, which best fits the ECMAScript standard (ECMA 262) and performs better optimizations than previous versions of the compiler.
  • An enhanced and enhanced application programming interface (API), with low object control and an authentic object-oriented model.
  • A nucleus of language based on the language specification draft ECMAScript (ECMA-262) edition 4.
  • An XML API based on the ECMAScript specification for XML (E4X) (ECMA-357 edition 2). E4X is an extension of the ECMAScript language that adds XML as a type of native language data.
  • An event model based on the specification of DOM events (document object model) level 3.

Version 3.0 improvements over its predecessors

ActionScript 3.0 increases the scripting capabilities of previous versions of ActionScript. It is designed to make it easy to build more complex applications with large data sets and reusable, object-oriented code bases. Although not required for content running in Adobe Flash Player 9, ActionScript 3.0 allows for performance improvements that are only available with AVM2, the new virtual machine. ActionScript 3.0 code can run ten times faster than legacy ActionScript code.

The older version of the ActionScript virtual machine (AVM1) runs ActionScript 1.0 and ActionScript 2.0 code. Flash Player 9 supports AVM1 for compatibility with existing and legacy content from earlier versions.

News

The following are some of the new features and benefits that this new version of ActionScript offers compared to previous versions. In truth it is more sophisticated in terms of its style and adaptation for others.

Runtime Exceptions

ActionScript 3.0 reports more error situations than previous versions of ActionScript. Runtime exceptions are used for frequent error situations and allow you to improve debugging and develop applications to robustly handle errors. Runtime errors may provide stack traces with source file information and line number. This allows you to quickly identify errors.

Runtime Types

Whereas in ActionScript 2.0, type annotations were primarily a developer aid; at run time, types were dynamically assigned to all values. In ActionScript 3.0, type information is persisted at run time and is used for a variety of purposes. Flash Player 9 performs type checking at runtime, which improves system type safety. The type information is also used to specify in native representations of the machine, which improves performance and reduces memory usage.

Classes closed

ActionScript 3.0 introduces the concept of closed classes. A closed class has only the fixed set of properties and methods defined at compile time; it is not possible to add additional properties and methods; although you can use them dynamically. Closing them allows for more stringent compile-time checking, which makes programs more robust. It also improves memory usage by not requiring an internal hash table for each object instance.

In addition, it is possible to use dynamic classes using the dynamic keyword. All ActionScript 3.0 classes are closed by default, but can be declared dynamic with the dynamic keyword.

Method closures

ActionScript 3.0 allows a method closure to automatically remember its original object instance. This function is useful in event management. In ActionScript 2.0, method closures did not remember the object instance from which they were extracted, which caused unexpected behavior when the method closure was called.

ECMAScript for XML (E4X)

ActionScript 3.0 implements ECMAScript for XML (E4X), recently standardized as ECMA-357. E4X offers a natural and fluid set of language constructs for manipulating XML. Unlike traditional XML parsing APIs, XML with E4X behaves like a native language data type. E4X streamlines the development of applications that manipulate XML, drastically reducing the amount of code required.

Regular Expressions

ActionScript 3.0 provides native support for regular expressions, which allow you to quickly find and manipulate strings.

Contenido relacionado

Boeing 747

The Boeing 747 is a wide-body transcontinental commercial airliner manufactured by Boeing. It is known for its large size, and for its characteristic nickname...

Windows Vista

Windows Vista is a discontinued version of Microsoft Windows, a line of operating systems developed by Microsoft. This version was focused on use on desktop...

Drum

A drum or tympanum is a percussion instrument with an indeterminate sound, belonging to the family of membranophones according to the Hornbostel-Sachs...
Más resultados...
Tamaño del texto:
Copiar