flash language_api_actionscript_3

ActionScript 3 language

ActionScript 3 integrates numerous new elements that we will investigate throughout these articles. This article will discuss the new functionalities and essential behaviors for all ActionScript 3 developers.

Before talking about all of the new stuff in ActionScript 3 we will first define what we mean by the term ActionScript. From a high level analysis ActionScript is made up of two important components:

  • The heart of the language: the ActionScript language is based on the ECMAScript (ECMA-262) specifications and partially integrates some functionalities derived from the ECMAScript specifications.
  • The Flash player API: these are Flash player functionalities. All of the classes that need to be imported are part of the player’s API and not of the ActionScript language.

The programming interface of the player or the language can be updated independently. The Flash 10 player was meant to integrate a native 3D manager as well as a more complete implementation of the ECMAScript 4 specifications. The 3D management only concerns Flash player’s programming interface unlike the new objects defined by the ECMAScript 4 which are directly linked to the heart of the ActionScript language.

On one side there is ActionScript 3 and on the other there is the player’s API which is generally called the programming interface.

Here are the two entities:

as3_v2.jpg

Contrary to previous versions of ActionScript in ActionScript 3 we can see that the different functionalities in the Flash player are stored in specific packages.

In order to display a video we use the objects in the flash.media package. To contact a server however we use the objects in the flash.net package. Flash CS3 is configured to automatically import Flash player’s API classes. It is therefore not necessary to manually import the classes when we code in the author environment.

An implicitImports.xml file situated at the heart of Flash CS3’s installation directory (C:\Program Files\Adobe\Adobe Flash CS3\fr\Configuration\ActionScript 3.0) contains all the class definitions to import:

<implicitImportsList>
<implicitImport name = "flash.accessibility.*"/>
<implicitImport name = "flash.display.*"/>
<implicitImport name = "flash.errors.*"/>
<implicitImport name = "flash.events.*"/>
<implicitImport name = "flash.external.*"/>
<implicitImport name = "flash.filters.*"/>
<implicitImport name = "flash.geom.*"/>
<implicitImport name = "flash.media.*"/>
<implicitImport name = "flash.net.*"/>
<implicitImport name = "flash.printing.*"/>
<implicitImport name = "flash.system.*"/>
<implicitImport name = "flash.text.*"/>
<implicitImport name = "flash.ui.*"/>
<implicitImport name = "flash.utils.*"/>
<implicitImport name = "flash.xml.*"/>
</implicitImportsList>

In order to create a dynamic clip we can write directly onto an image on the timeline:

var monClip:MovieClip = new MovieClip();

If we put the code in the classes outside the Flash we need to explicitly import the necessary classes:

import flash.display.MovieClip;
var monClip:MovieClip = new MovieClip();

In these articles we will not import the player classes when we develop in the Flash author environment. From article 8 Object Oriented Programming we will explicitly import used classes.

Worth remembering:

  • ActionScript 3 is made up of two components: the heart of the language and the programming interface of the player.
  • The heart of the language is defined by the ECMAScript specifications.







Adobe Training center


Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42