ActionScript and JavaScript – Some differences

Some of the differences between ActionScript and JavaScript are as follows:

• ActionScript does not support browser-specific objects such as Document, Window,
and Anchor.
• ActionScript does not completely support all the JavaScript built-in objects.
• ActionScript does not support some JavaScript syntax constructs, such as statement labels.
• In ActionScript, the eval() action can perform only variable references

An introduction to important ActionScript terms.

Actions are statements that instruct a SWF file to do something while it is playing. For example,
gotoAndStop() sends the playhead to a specific frame or label. In this manual, the terms action
and statement are interchangeable.
Boolean is a true or false value.
Classes are data types that you can create to define a new type of object. To define a class,
you use the class keyword in an external script file (not in a script you are writing in the
Actions panel).

Constants are elements that don’t change. For example, the constant Key.TAB always has the
same meaning: it indicates the Tab key on a keyboard. Constants are useful for comparing values.
Constructors are functions that you use to define the properties and methods of a class.
By definition, constructors are functions within a class definition that have the same name
as the class. For example, the following code defines a Circle class and implements a
constructor function:
// file Circle.as
class Circle {
private var radius:Number
private var circumference:Number
// constructor
function Circle(radius:Number) {
circumference = 2 * Math.PI * radius;
}
}
The term constructor is also used when you create (instantiate) an object based on a particular
class. The following statements are constructors for the built-in Array class and the custom
Circle class:
my_array:Array = new Array();
my_circle:Circle = new Circle();

Data types describe the kind of information a variable or ActionScript element can hold. The
ActionScript data types are String, Number, Boolean, Object, MovieClip, Function, null, and
undefined.

Events are actions that occur while a SWF file is playing. For example, different events are
generated when a movie clip loads, the playhead enters a frame, the user clicks a button or movie
clip, or the user types on the keyboard

Event handlers are special actions that manage events such as mouseDown or load. There are two
kinds of ActionScript event handlers: event handler methods and event listeners. (There are also
two event handlers, on() and onClipEvent(), that you can assign directly to buttons and movie
clips.) In the Actions toolbox, each ActionScript object that has event handler methods or event
listeners has a subcategory called Events or Listeners. Some commands can be used both as event
handlers and as event listeners and are included in both subcategories

Identifiers are names used to indicate a variable, property, object, function, or method. The first
character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a
letter, number, underscore, or dollar sign. For example, firstName is the name of a variable.

Instances are objects that belong to a certain class. Each instance of a class contains all the
properties and methods of that class. For example, all movie clips are instances of the MovieClip
class, so you can use any of the methods or properties of the MovieClip class with any movie
clip instance

Instance names are unique names that let you target movie clip and button instances in scripts.
You use the Property inspector to assign instance names to instances on the Stage. For example, a
master symbol in the library could be called counter and the two instances of that symbol in
the SWF file could have the instance names scorePlayer1_mc and scorePlayer2_mc. The
following code sets a variable called score inside each movie clip instance by using
instance names:
_root.scorePlayer1_mc.score += 1;
_root.scorePlayer2_mc.score -= 1;
You can use special suffixes when naming instances

Methods

are functions associated with a class. For example, getBytesLoaded() is a built-in
method associated with the MovieClip class. You can also create functions that act as methods,
either for objects based on built-in classes or for objects based on classes that you create

Objects are collections of properties and methods; each object has its own name and is an
instance of a particular class. Built-in objects are predefined in the ActionScript language. For
example, the built-in Date object provides information from the system clock

Packages are directories that contain one or more class files, and reside in a designated classpath
directory

Target paths are hierarchical addresses of movie clip instance names, variables, and objects in a
SWF file. You name a movie clip instance in the movie clip Property inspector. (The main
Timeline always has the name _root.) You can use a target path to direct an action at a movie clip
or to get or set the value of a variable.

Courtesy: http://makinguseofpython.blogspot.com/2007/03/actionscript.html