
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
24
Chapter 3
CHAPTER 3
Datatypes and Type Checking
ActionScript 2.0 defines a wide variety of datatypes. Some datatypes are native to the
language itself (e.g., String, Number, and Boolean). Others are included in the Flash
Player and are available throughout all Flash movies (e.g., Color, Date, and
TextField). Still other datatypes are defined by components that can be added indi-
vidually to Flash movies (e.g., List, RadioButton, and ScrollPane).
For a primer on ActionScript’s datatypes, see Chapter 3 of ActionScript for Flash MX:
The Definitive Guide (O’Reilly), available online at http://moock.org/asdg/samples.
In addition to using ActionScript 2.0’s datatypes, developers can add new datatypes
to a program by creating classes (covered in Chapter 4) and interfaces (covered in
Chapter 8). Every value in ActionScript 2.0 belongs to a datatype, whether built-in or
programmer-defined. When we work with a value, we must use it only in ways sup-
ported by its datatype. For example, we can call getTime( ) on a Date object, but we
must not call gotoAndPlay( ) on a Date object, because the Date class does not sup-
port the gotoAndPlay( ) method. On the other hand, we can call gotoAndPlay( ) on a
movie clip because that method is defined by the MovieClip class.
In order for an object-oriented ...