Working with classes - POO in Actionscript 2

I’m tryin’ to define a simple class in actionscript2 but I receive some errors.

Here’s the code done in actionscript editor: (name of the file is NavaSpatiala.as)


class NavaSpatiala

{ // proprietate publica numita viteza (data membru)

public var viteza:Number;

// proprietate privata numita damage

private var damage:Number;

// constructor ce initializeaza fiecare instanta a clasei

public function NavaSpatiala()
{ viteza = 100;
  damage = 0;
}

// functie de returnare a vitezei

public function intoarceViteza():Void
{this.viteza = viteza;
}

} // end of Class NavaSpatiala

// instantiem 3 obiecte pt.clasa NavaSpatiala

var nava 1:NavaSpatiala = new NavaSpatiala();
var nava 2:NavaSpatiala = new NavaSpatiala();
var nava 3:NavaSpatiala = new NavaSpatiala();

nava1.intoarceViteza(); // apel functie pt. obiect 1

// setam proprietatea viteza la 120 si 140 pt.ob2 si ob3

nava1.viteza=120; trace("Viteza navei 2 e: "+nava1.viteza);
nava2.viteza=140; trace("Viteza navei 2 e: "+nava2.viteza);
nava3.viteza=140; trace("Viteza navei 2 e: "+nava3.viteza);
}

Errors that I receive:


Classes may only be defined in external ActionScript 2.0 class scripts. line 1


The file name is NavaSpatiala.as

How I can use import command in class1.fla (I mean what is the contents of class1.fla when I use command import to import external class defined in NavaSpatiala.as) if I copy this code to NavaSpatiala.as to solve this error:

Classes may only be defined in external ActionScript 2.0 class scripts. line 1

Hope you understand my question. I need to get rid of this error:

Classes may only be defined in external ActionScript 2.0 class scripts. line 1