45
CHAPTER 2
Creating Custom Classes with ActionScript 2.0
ActionScript 2.0 provides several powerful programming features found in other programming
languages, such as Java. ActionScript 2.0 encourages program structures that are reusable,
scalable, robust, and maintainable. It also decreases development time by providing users
thorough coding assistance and debugging information. ActionScript 2.0 conforms more closely
to the ECMA-262 Edition 3 standard (see
www.ecma-international.org/publications/standards/
Ecma-262.htm
).
The main features of ActionScript 2.0 include the following:
Familiar object-oriented programming (OOP) model
The primary feature of
ActionScript 2.0 is a familiar model for creating object-oriented programs. ActionScript 2.0
implements several object-oriented concepts and keywords such as
class
,
interface
, and
packages
that will be familiar to you if you’ve programmed with Java.
Strict data typing
ActionScript 2.0 also lets you explicitly specify data types for variables,
function parameters, and function return types. For example, the following code declares a
variable named
userName
of type String (a built-in ActionScript data type, or class).
var userName:String = "";
Compiler warnings and errors
The previous two features (OOP model and strict data typing)
enable the compiler to provide warnings and error messages that help you find bugs in your
applications.
Principles of object-oriented programming
This section provides a brief introduction to principles involved in developing object-oriented
programs. These principles are described in more depth in the rest of this chapter, along with
details on how they are implemented in Macromedia Flex.
To learn about object-oriented programming principles, see the following topics:
•
“Objects” on page 46
•
“Classes and class members” on page 46
•
“Inheritance” on page 46
•
“Interfaces” on page 47
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...