Before we begin with ActionScript, we should know that As3 is an object oriendted programming language (OOP) and thus it's highly sujjested you go through the Introduction of OOP article before continuing...
A quick Summary of OOP ::
In the oop model, pieces of code are considered objects and each such object is properly defined by a class with variables and functions specific to the object. Such discrete pieces of code can be easily reused and allows for encapsulation.
Creating you first class and package
A package is a collection of classes, more like a folder with all the classes needed for the project.
And classes are pieces of code that define functions and variables specific to an object.
lets not get into the details now and start with our first class which defines a Ball Object.

Open Flash and choose to create a new file (Ctrl+N) and select ActionScriptFile and write the code as shown below and save it as Ball.as

Note:: A package name is also the relative path to the class with respect to the flash files. So in this case if you intent to save your flash files in the C:\ Drive, the the actionscript file (Ball.as) sholud be saved in C:\mypackage\as3\

Code::
package mypackage.as3 {
class Ball
{
 import flash.display.*;
 var x:Number;
 var y;Number;

function Ball(){
// some initialization code here 
trace("Object Successfully created");
}

public function changeSize(){
// code to change size here

private function secret(){
// some code, whose functionality you wish to hide
}
}
}


   Code Description ::
package mypackage.as3

in this line, we are defining a package, which acts as a repository of all our classes written for the specific application.
class Ball{
import flash.display.*;

in the first line, we are defining our class which contains properties and functions of any Ball object that we use in our program. And the second line imports all classes from the display package so that they could be used in our class.
 var x:Number;
 var y:Number;

Now we are creating two variables x and y which will exist for every instance of the ball object which we create in the future.
here "var" keyword indicates that we are creating a new variable of name "x" and ":Number" tells it what type of variable it is. In this case, a number.
Syntax for Creating a new Variable :: var variableName:variableType;

function Ball(){
// some initialization code here 
trace("Object Successfully created");
}
Here, we are defining a constructor. A constructor is a special function which is executed as soon as an instance of an object is created. It is distinguished from other functions as it has the same name as the class.
The trace function is one that is heavily used for debugging in flash. This function prints the arguments passed into an output window. In this case, it prints "Object Successfully created".

public function changeSize(){
// code to change size here
Here, we are defining a normal function by the name changeSize. The function type is set to public (access modifier) which means that it can be accessed from outside the class too.
  • AcessModifiers can be prefixed to classes, functions and any kind of variables.
private function secret(){
// some code, whose functionality you wish to hide
}
Here, we are defining another function, only this time, the access modifier set to private which means it can only be called from inside the class.

Syntax for Defining a function :: function functionName(parameters-here){ }


This is just the actionscript class for an object, Ball. You will not be able to see the output as we have'nt created any instance of the ball object yet. And even if you feel a little intimidated by all the jargon and complexity of OOP, i can best assure you you can still go ahead as one can develop applications without using classes too...
Read the acticle, Implementing Custom classes to know how to implement classes and custom objects into Flash.