BrainMeta'   Connectomics'  

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Actionscript 3:overview
Guest
post Feb 05, 2006, 11:45 PM
Post #1


Unregistered









ActionScript 3:overview

From Adobe Labs

Table of contents [showhide]
1 ActionScript 3.0 Overview

1.1 Goals of ActionScript 3.0
1.2 Features of ActionScript 3.0
1.3 Language Features

1.3.1 Runtime Exceptions
1.3.2 Runtime Types
1.3.3 Sealed Classes
1.3.4 Delegation

1.4 ECMAScript for XML (E4X)

1.4.1 Regular Expressions
1.4.2 Namespaces
1.4.3 New Primitive Types

1.5 Flash Player API Features

1.5.1 DOM3 Event Model
1.5.2 Display List API
ActionScript 3.0 Overview

ActionScript 3.0 is a powerful object-oriented programming language that signifies an important evolution of the capabilities of the Flash Platform. The motivation driving ActionScript 3.0 is to create a language ideally suited for rapidly building Rich Internet Applications, which have become an essential part of the Web experience. Earlier versions of ActionScript offered the power and flexibility required for creating truly engaging online experiences. ActionScript 3.0 now further advances the language, providing superb performance and ease of development to facilitate highly complex applications, large datasets and object-oriented, reusable code bases. With ActionScript 3.0, developers can achieve excellent productivity and performance with the Flash Platform.

ActionScript 3.0 is based on ECMAScript, the international standardized programming language for scripting. ActionScript 3.0 is compliant with the ECMAScript language specification.

ActionScript is executed by the ActionScript Virtual Machine (AVM) built into the Flash Player. AVM1, the virtual machine used to execute legacy ActionScript code, powers the Flash Platform today and makes possible a wide range of interactive media and Rich Internet Applications. However, developers have started to push AVM1 to its limits – their project requirements now demand a major breakthrough. ActionScript 3.0 introduces a new highly-optimized ActionScript Virtual Machine, AVM2, which dramatically exceeds the performance possible with AVM1. As a result, ActionScript 3.0 code executes up to 10X faster than legacy ActionScript code.

The new AVM2 virtual machine is available in Flash Player 8.5, and will be the primary virtual machine for ActionScript execution going forwards. The older AVM1 will continue to be supported by the Flash Player for backwards compatibility with existing and legacy content.

There are numerous products that generate content and applications targeted at the Flash Player, and often these products incorporate support for ActionScript to add interactivity and behavior to their output. In the Macromedia product family, professional designers and developers might use ActionScript within several tools and servers, such as Macromedia Flash, Flex, and Flash Media Server to create content and applications for the Flash Player. The Flex 2.0 product family, including the new Eclipse-based Flex Builder 2 IDE, will be the first product line to access the new capabilities of ActionScript 3.0.
Goals of ActionScript 3.0

We wanted ActionScript 3.0 to deliver an improved, consistent programming model, compliance with industry standards, and performance an order of magnitude greater than what we have delivered in the past. Although ActionScript 3.0 represents a new programming model for the Flash Platform, it is one that will be familiar to developers with a basic knowledge of object-oriented programming.

ActionScript 3.0 is designed to address the following goals:

* Safety - The language supports type safety so developers can write unambiguous, easily maintainable code.

* Simplicity - The language is intuitive enough for developers to be able to read and write programs without constantly consulting a reference manual.

* Performance - The language enables developers to write complex programs that perform efficiently and responsively.

* Compatibility - The language provides a short backward and forward compatibility path and a significant overlap with industry-standards. ActionScript 3.0 is a dialect of ECMAScript which formalizes the features of ActionScript 2.0, adds the capabilities of ECMAScript for XML (E4X), and unifies the language into a coherent whole.

Features of ActionScript 3.0

ActionScript 3.0 consists of two parts: the core language and the Flash Player API. The core language defines the basic building blocks of the programming language, such as statements, expressions, conditions, loops, and types. The Flash Player API is comprised of classes which represent and provide access to Flash Player-specific functionality.

ActionScript 3.0 contains a host of powerful new features that can greatly speed the development process. Regular expression support enables a variety of powerful operations on text. ECMAScript for XML (E4X) transforms XML into a native data type, dramatically simplifying XML processing. The new Display List API makes working with visual objects far more straightforward and consistent. The standardized DOM event model cements the way those objects talk and respond to each other at runtime. These are only a few of the many new capabilities of ActionScript 3.0.
Language Features

ActionScript 3.0 brings the core language aspects of ActionScript 2.0 into compliance with the ECMAScript standard and introduces some areas of new or enhanced functionality. All of these features are discussed in comprehensive detail in the ActionScript 3.0 Language Reference, available in alpha version on Macromedia Labs. Below is a high-level summary of the developer benefits and usage of some of the new features.
Runtime Exceptions

In ActionScript 2.0, many runtime errors would fail in a graceful but silent fashion. This ensured that the Flash Player would not pop up some inexplicable dialog box, the way JavaScript did in early Web browsers. On the other hand, this lack of error reporting made it more challenging to debug ActionScript programs. ActionScript 3.0 introduces a variety of runtime exceptions for common error conditions, improving the debugging experience and enabling applications that handle errors robustly. Runtime errors can provide stack traces annotated with source file and line number information, helping to quickly pinpoint errors.
Runtime Types

In ActionScript 2.0, type annotations were primarily a developer aid; at runtime, all values were dynamically typed. In ActionScript 3.0, type information is preserved at runtime, and utilized for a number of purposes. The Flash Player performs runtime type checking, improving the system’s type safety. Type information is also used to represent variables in native machine representations, improving performance and reducing memory usage.
Sealed Classes

ActionScript 3.0 introduces the concept of a sealed class. A sealed class possesses only the fixed set of properties and methods that were defined at compile-time; additional properties and methods cannot be added. This makes stricter compile-time checking possible, resulting in more robust programs. It also improves memory usage, by not requiring an internal hashtable for each object instance. Dynamic classes are also possible using the dynamic keyword.
Delegation

Event handling is simplified in ActionScript 3.0 thanks to its built-in delegation. In ActionScript 2.0, method closures would not remember what object instance they were extracted from, leading to unexpected behavior when the method closure was invoked. The mx.utils.Delegate class was a popular workaround; to use it, you would write code as follows:

myButton.addEventListener(“click”, Delegate.create(this, someMethod)); Delegate.create(this, someMethod)

This class is no longer needed, since a method closure will now automatically remember its original object instance. Now, one can simply write:

myButton.addEventListener(“click”, someMethod);
ECMAScript for XML (E4X)

ActionScript 3.0 features a full implementation of ECMAScript for XML (E4X), recently standardized as ECMA-357. E4X offers a natural, fluent set of language constructs for manipulating XML. Unlike traditional XML parsing API’s, E4X makes XML feel like a native data type of the language. E4X streamlines the development of applications that manipulate XML by drastically reducing the amount of code needed. You can learn more about the E4X specification here:

http://www.ecma-international.org/publicat...ST/ECMA-357.pdf
Regular Expressions

ActionScript 3.0 includes native support for regular expressions so you can quickly search for and manipulate strings. ActionScript 3.0 implements the regular expressions defined in the ECMAScript Edition 3 language specification (ECMA-262).
Namespaces

Namespaces are an innovative new mechanism for controlling visibility of declarations. Namespaces are similar to the traditional access specifiers used to control visibility of declarations (public, private, protected). They are essentially custom access specifiers, which can have names of your choosing. The Flex Framework, for example, uses an mx_internal namespace for its internal data. Namespaces are outfitted with a Universal Resource Identifier (URI) to avoid collisions, and are also used to represent XML namespaces when working with E4X.
New Primitive Types

ActionScript 2.0 had a single numeric type, Number, a double-precision floating point number. One welcome addition to ActionScript 3.0 is the new int type. The int type is a 32-bit signed integer, and lets ActionScript code take advantage of the fast integer math capabilities of the CPU. int is great for loop counters and almost anywhere a decimal point isn’t needed. Another new type is uint, an unsigned 32-bit integer type similar to int. uint is primarily useful for pixel color values and other quantities where int doesn't work well.
Flash Player API Features

The Flash Player API is a set of classes and functions that expose the capabilities of the Flash Player to the ActionScript language. This functionality is the bridge between the ActionScript core language and the rest of the Flash Platform. It is the source of much of the power available to Flash applications and is a very important complement to the core language. There isn’t space here to cover the API’s in detail, but here is a short list of some of the new and interesting functionality available to developers:
DOM3 Event Model

The event model provides a standard way of generating and handling event messages so that objects within applications can interact and communicate, maintaining state and responding to change. Patterned after the W3C DOM3 Events specification, this model provides a clearer and more efficient mechanism than the event systems available in previous versions of ActionScript. The Flex application framework uses the same event model as the Flash Player API, so the event system is unified across the Flash Platform from top to bottom.
Display List API

The Display List API consists of a revamped set of classes for working with Flash’s visual primitives.

The new Sprite class is a lightweight building block, similar to MovieClip but more appropriate as a base class for UI components. The new Shape class represents raw vector shapes. These classes can be instantiated naturally with the new operator and can be dynamically re-parented at any time.

There is no longer any need to assign depth numbers to display list objects. Depth management is now automatic and built into the Flash Player. New methods are provided for specifying and managing the z-order of objects.

Of course, this ActionScript 3.0 overview only outlines a few of the exciting APIs and language features you’ll discover as you learn more about ActionScript 3.0. The Programming in ActionScript 3.0 book is a good place to start for information on how to implement programming concepts in ActionScript, and the ActionScript 3.0 Language Reference will be the definitive source for complete information about the core language and the Flash Player API. Also, if you’re already familiar with ActionScript 1.0 or 2.0, check out Tips for Learning ActionScript 3.0.

The Flash Player team is thrilled to be able to deliver a preview of the language, its new capabilities and improved performance to the community through Macromedia Labs. You will be able to explore ActionScript 3.0 to see where we are taking the language through Flex Builder 2.0, the Flex Framework and Flash Player 8.5. We hope you are as excited as we are about the future of the Flash Platform, and look forward to the feedback you will provide us through Labs.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 19th November 2017 - 11:55 AM


Home     |     About     |    Research     |    Forum     |    Feedback  


Copyright BrainMeta. All rights reserved.
Terms of Use  |  Last Modified Tue Jan 17 2006 12:39 am

Consciousness Expansion · Brain Mapping · Neural Circuits · Connectomics  ·  Neuroscience Forum  ·  Brain Maps Blog
 · Connectomics · Connectomics  ·  shawn mikula  ·  shawn mikula  ·  articles