
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
142
|
Chapter 5: Authoring an ActionScript 2.0 Class
Here’s the final class design for this version. It repeats information from tables 5-1
and 5-2 in order to show how you might represent a class during the design phase of
a project, perhaps before you’ve actually produced any code:
Constructor
ImageViewer(target:MovieClip, depth:Number, x:Number, y:Number,
w:Number, h:Number, borderThickness:Number, borderColor:Number)
Private properties
container_mc
target_mc
containerDepth
imageDepth
maskDepth
borderDepth
borderThickness
borderColor
Public properties
None
Private methods
buildViewer(x:Number, y:Number, w:Number, h:Number)
createMainContainer(x:Number, y:Number)
createImageClip( )
createImageClipMask(w:Number, h:Number)
createBorder(w:Number, h:Number)
Public methods
loadImage(URL:String)
ImageViewer Implementation (Take 2)
Example 5-5 shows the actual code for the ImageViewer class, version 2. Study the
comments carefully for code explanations. If some of the specific ActionScript tech-
niques are new to you (e.g., drawing lines or masking movie clips), consult an
ActionScript language reference such as ActionScript for Flash MX: The Definitive
Guide (O’Reilly).
Example 5-5. The ImageViewer class, take 2
// ImageViewer class, Version 2
class ImageViewer {
// Movie clip references
private var container_mc:MovieClip; ...