External ActionScripting class file
A CLASS is a flash object. In a generic way "a class" is the code portion of an object. Movieclips
or buttons are flash objects with certain properties, the actionScript code
that can control and modify those object is known as the "class"of the object (like
the "movieclip class").
A class FILE is an external file that contains ActionScripting and is attached to a flash movie, providing the code for what the file will do when played as an swf. This type of file is named like: "name.as". Programmers don't work with the file timeline, they place the complete code for the project in an external file.
You have to be careful when you name
this" Actionscript external file" because you will have to write the name
it on a text field that says "document class" located in the Properties
panel when you have no tool selected .This will make the swf find the
code when it runs. You will also have to use that name inside the class
as you will see below.
When you write one class file that will apply to the whole project we say we are using " a single class method".
We could also use a class file for an specific object in the project, like a movieclip.
As any other external file it should be kept in the root folder with the swf and html file and copied to the server.
The codein the file is
slightly different that what you write when the code is attached to a
keyframe on the main timeline of the fla, mostly because you have to
begin by calling the classes that you are going to need to run the code.
An object constructor
You can build new objects directly with actionscript 3.0, without building them on the Stage attached to a frame. This is the generic formula for that. The name of the object is the only part of the code that you will make up.
var name: type = Newtype
Flash (display) objects are: TextField, MovieClip, Sprite, Bitmap, Shape...