# Fully qualified class references

A class file that's located in a top-level classpath location (that is, not nested within another folder), can be referenced simply by the class name. For example, suppose the following class named CustomClass is defined in the file CustomClass.as, and resides in a top-level classpath location:

    // CustomClass.as
    class CustomClass {
    	// class definition
    }

From within another file (a FLA or external AS file), you could create an instance of that class as follows:

    myInstance = new CustomClass();

In this case, because the class file is located in a top-level classpath location, it's fully qualified name is simply the name of the class itself.

Note: If you're using relative classpaths (like ".", or "../classes"), keep in mind that they are always relative to the current file, so class references may not always resolve. For more information, see "Relative classpaths" on page 144.

If a class file is located within a package, the fully qualified name includes the path to the package. For example, suppose that CustomClass.as is located in the myClasses package:

    // CustomClass.as, located in the package folder 'myClasses'
    class myClasses.CustomClass {
    	// class definition
    }

From within another file (a FLA or external AS file), you could create an instance of that class by referencing its full classpath.

    var myInstance:myClasses.CustomClass = new myClasses.CustomClass();

In this case, the fully qualified name contains the package name and the class name, separated by a dot ("."). Whenever you refer to a class using its fully qualified name, Flash compiles and imports it.