As an ActionScript programmer, you can create an unlimited variety of applications. The more experience you gain, the more you'll realize how often you end up writing code that performs certain custom tasks over and over again. For example, let's say that last month you created an address book application for a client. This month you learn that you need to create an employee directory for the same client. Immediately you'll notice that there are many similar features between an address book and an employee directory. In fact, an employee directory may have all the features of the address book, plus some extras. If you created an address book class for the address book application, you would be able to reuse it for the employee directory application.
In this lesson, you will create several custom classes whose functionality will be plugged into several movie clips, allowing instances of those clips to perform customized tasks.
Creating custom classes helps promote code reusability and is essential for well-written object-oriented programming. In this lesson, you will be introduced to the syntax and concepts needed to create custom classes and you will gain experience writing your own classes.
WHAT YOU WILL LEARN
In this lesson, you will:
Learn class syntax and terminology
Learn about classpaths and how they're used
Learn about private, public, and static members, and how to use them
Use inheritance to extend a class
Use overriding
Create custom object classes
Associate a custom class with a movie clip in the library
APPROXIMATE TIME
This lesson takes approximately two hours to complete.
LESSON FILES
Starting Files:
Lesson07/Assets/CurrencyConverter1.fla
Lesson07/Assets/PetParade1.fla
Completed Projects:
CurrencyConverter2.fla
PetParade2.fla
Animal.as
Dog.as
Cat.as