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
.
NO
T
E
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.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...