Actionscript 3.0 is the new Flash Actionscript language that was designed to build rich Internet Applications using Object Oriented Programming (OOP). The New ActionScript Virtual Machine that is built into the flash 9 player executes ActionScript 3.0 code ten times faster than older Actionscript. Actionscript 3.0 will let Flash CS3 programmers to write efficient and complex code that responds quickly to user needs. Actionscript 3.0 is a subset of the ECMAScript which adds various capabilities for XML. This changes XML into a native data type thus making XML processing straight forward and easy.
ActionScript 3.0 now has more robest runtime exception handling for the most common error situations that improve debugging and error handling. Runtime errors show stack traces that have the source file and line number that will simplify finding errors in your code. Sealed classes have been introduced that have only the predefined set of functions and properties for compiling. Extra properties and functions can be added but must use the dynamic keyword.
Actionscript 3.0 Datatypes
Actionscript 3.0 has new primitive datatypes. Originally Actionscript 2.0 only had the datatype of Number for all numerics whether they were integers, floating point numbers, doubles, etc. Now there is a new datatype int which is a 32 bit signed integer datatype that makes processing faster for non-decimal numbers such as loops and counter, for example. It is also suggested that variables be strongly typed. That is, they should be declared formally. Like this for instance:
Constants can be declared like this:
const SPEED:Number = 10;
Actionscript 3.0 Classes
Classes can contain properties, methods, and/or events. Properties of a class are the variables of that class and could beb a value something like the acceleration of a clas instance:
A method is an action that can be done by a class or any of its instances. Say for example if you have a Rocket class you might want to make it fire:
var rocket1:Rocket = new Rocket();
or do collision detection:
Actionscript 3.0 Events
Events are usually actions initiated by the user. Usually the program has to sit idle and wait for the user to click the mouse or hit a key. Events tell the Actionscript program about the user-initiated actions. Events are usually listened for with a Listener and then handled. Say if a user clicks a menu item , then the Event handler may load a particular sequence associated with that menu item. To create a new Object or class instance you will need the use the keyword “new”. For example if you had a Car class and you wanted to create a blue car, then you might do so like this:
var blueCar:Car = new Car(“blue”);
Actionscript 3.0 Operators
Operators are special symbols that are used to perform calculations and to compare one value against another to see if it is larger, smaller or the same. Some types of operators are Addition (+) :
var sum:Number = heightUp + heightDown;
or Multiplication (*):
var product = SPEED * accel;
Other operators include equality (==), greater than (>) , less than (<).