Importing classes

The first line of your external ActionScript class file should import necessary class files that your class uses. This includes classes that provide functionality, as well as the superclass your class extends, if any.

You import the fully qualified class name, rather than the filename of the class, when using the import statement, as the following example shows:

import mx.core.UIObject;
import mx.core.ScrollView;
import mx.core.ext.UIObjectExtensions;

You can also use the wildcard character (*) to import all the classes in a given package. For example, the following statement imports all classes in the mx.core package:

import mx.core.*;

If an imported class is not used in a script, the class is not included in the resulting SWF file's bytecode. As a result, importing an entire package with a wildcard does not create an unnecessarily large SWF file.