In this part of our Actionscript tutorial we will introduce some of the basic programming code elements. Knowing the basic Actionscript syntax will allow you to build and understand simple code structures and ease your learning process.

First the programmer must know that the Actionscript programming language is case sensitive (for example gotoAndPlay is a valid movie clip method, while gotoandplay will not work).

Actionscript is an object oriented language. There are classes and variables, constants and methods defined for them. Variables and constants get values while the methods are functions, which apply a defined behaviour for the objects of the class. An object which is defined by a class can use all the methods set for this class.

An example of a class declaration is:

public class myClass {
//variables
var x; var y;
//methods
public function myfunc() {
//some code
} //additional methods }

Then in your code you can create a new object of the above class:
var myObj:myClass = new myClass();

One of the Actionscript's default classes is Array. A new object of this class can be created as follows:
var names:Array = new Array("John", "Tom", "Jane");

We will list some of the special characters from the Actionscript code:
  • The semicollon ; defines the end of the statements.
  • Parentheses () group arguments that apply to a statement.
  • The curly braces {} group all related statements.
  • The // slashes sequence is used to include comments in the code.
  • The colon : sign is used to define the variable type. In the current example it defines that myObj is an object of the myClass class.

In the next part of our Flash Actionscript tutorial we will provide several Actionscript web elements examples and a detailed explanation of every line of their code.