7.1 Extending ImageViewer s Capabilities

 <  Day Day Up  >  

7.1 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 been added directly to the ImageViewer class. For the sake of this example, we'll presume that we don't have access to the ImageViewer source code, perhaps because it's a commercial component that isn't open source. In other words, in this case we're using inheritance out of faux necessity, not because it necessarily provides the best design. This often happens when working with standard class libraries and components . In Part III, we'll study more complex interclass relationships, in which inheritance is a matter of choice rather than circumstance.

 <  Day Day Up  >  


Essential ActionScript 2.0
Essential ActionScript 2.0
ISBN: 0596006527
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Colin Moock

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net