
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
215
Chapter 7
CHAPTER 7
Authoring an ActionScript 2.0
Subclass
In the preceding chapter, we learned the principles of inheritance in ActionScript 2.0.
In this chapter, we’ll study an applied inheritance example, ImageViewerDeluxe. The
ImageViewerDeluxe class is a subclass of the ImageViewer class that we created in
Chapter 5. You’ll need the files from that chapter for this tutorial (see Example 5-8
and “Using ImageViewer (Take 2)”), or you can download them from http://moock.
org/eas2/examples. The ImageViewerDeluxe source files discussed in this chapter are
available from the same URL.
Extending ImageViewer’s Capabilities
Recall from Chapter 5 the list of possible functional requirements for our
ImageViewer class:
• Load an image
• Display an image
• Crop an image to a particular rectangular “view region”
• Display a border around the image
• Display image load progress
• Reposition the view region
• Resize the view region
• Pan (reposition) the image within the view region
• Zoom (resize) the image within the view region
The ImageViewer class already implements the first five requirements, but it stops
there. In the ImageViewerDeluxe class, we’ll add the next two items on the list: the
abilities to reposition and resize the viewer. It’s important to note that those features
could easily have ...