Example: Creating a complex interface 327
23.In classeTest.fla, type the following ActionScript code on Frame 1 of the Timeline:
// filename: classeTest.fla
import ClassE;
var myE:ClassE = new ClassE();
trace(myE.k()); // 15
trace(myE.n(7)); // 12
myE.o(); // o
myE.p(); // p
24.
Save the Flash document, and then select Control > Test Movie to test the SWF file.
The values
15, 12, o, and p display in the Output panel. These values are the values that
return from the
ClassE.k(), ClassE.n(), ClassE.o(), and ClassE.p() methods. Since
the ClassE class implemented both the InterfaceB and InterfaceC interfaces, each method
from the two interface files must be defined. Although the InterfaceB and InterfaceC
interfaces only define the
o() and p() methods, InterfaceC extends InterfaceA. This
means that all of its defined methods,
k() and n(), must also be implemented.