About interfaces 315
For more information on using interfaces, see the following sections:
■ “About the interface keyword” on page 315
■ “About naming interfaces” on page 315
■ “Defining and implementing interfaces” on page 316
About the interface keyword
The interface keyword defines an interface. An interface is similar to a class, with the
following important differences:
■ Interfaces contain only declarations of methods, not their implementation. That is, every
class that implements an interface must provide an implementation for each method
declared in the interface.
■ Only public members are allowed in an interface definition; static and class members are
not permitted.
■ The get and set statements are not allowed in interface definitions.
■ To use the interface keyword, you must specify ActionScript 2.0 and Flash Player 6 or
later in the Flash tab of your FLA file’s Publish Settings dialog box.
The
interface keyword is supported only when used in external script files, not in scripts
that you write in the Actions panel.
About naming interfaces
Interface names have an uppercase first letter, the same as class names. Interface names are
usually adjectives, such as
Printable. The following interface name, IEmployeeRecords,
uses an initial uppercase letter and concatenated words with mixed case:
interface IEmployeeRecords {}
For more information on naming conventions, see Chapter 19, “Best Practices and Coding
Conventions for ActionScript 2.0,” on page 731.
NOTE
Some developers start interface names with an uppercase “I” to distinguish them from
classes. This is a good practice to adopt because it lets you quickly distinguish between
interfaces and regular classes.