Lesson 7. Creating Custom Classes
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 LEARNIn this lesson, you will:Learn class syntax and terminologyLearn about classpaths and how they're usedLearn about private, public, and static members, and how to use themUse inheritance to extend a classUse overridingCreate custom object classesAssociate a custom class with a movie clip in the libraryAPPROXIMATE TIMEThis lesson takes approximately two hours to complete.LESSON filesStarting Files:Lesson07/Assets/CurrencyConverter1.flaLesson07/Assets/PetParade1.flaCompleted Projects:CurrencyConverter2.flaPetParade2.flaAnimal.asDog.asCat.as
• Table of ContentsMacromedia® Flash MX 2004 ActionScript: Training from the SourceBy
Derek Franklin, Jobe Makar Publisher: Peachpit PressPub Date: November 19, 2003ISBN: 0-321-21343-2Pages: 636
Sure, you can use Flash MX 2004 without being a master programmer, but as any Flash developer worth his or her salt will tell you, you''''re not tapping all of its power unless you''''re taking advantage of its scripting language "ActionScript 2.0" which offers a more robust programming model and better object-oriented programming support than ever before. Here to take the fear factor out of learning it are Flash veterans and best-selling authors Derek Franklin and Jobe Makar, who demonstrate that scripting is an instinctual process you already know by translating real-life activities into ActionScript scripts. In these pages, you''''ll find methodologies and techniques for building over 40 real-life Flash ActionScript projects, including sample games, applications, Web sites, and more. New in this edition are coverage of ActionScript 2.0, Web services, Components, Printing, Video, and more. On the companion CD, you''''ll find all the project files and images you need to complete each project.