Built-in ActionScript Classes and Objects
We’ve really come a long way since Chapter 1. Our first exposure to the components of ActionScript was a simple perusal of the items under the + button in the Actions panel. Since then, we’ve learned about data and expressions, operators, statements, and functions, and now we’ve explored the concept of classes and objects. It’s time to put the final brush strokes on the picture we’ve been painting of the ActionScript language.
ActionScript comes with a variety of syntactic tools:
expressions contain data;
operators manipulate data;
statements give instructions; and
functions group instructions into portable
commands. These are tools, but they are just
tools. They’re the grammar we use to compose instructions in
our scripts. What we’re still missing is subject
matter. By now we know perfectly well how to speak
ActionScript, but we have nothing to talk about. The built-in classes
and objects of ActionScript fill that void.
Built-in Classes
Just
as
we define our own classes to describe and manipulate objects created
according to our specifications, ActionScript defines its own classes
of data. A variety of prefabricated classes, including the
Object
class, are built right into the
ActionScript language. The built-in classes can control the physical
environment of a Flash movie.
For example, one of the built-in classes, the
Color
class, defines methods that can detect or
set the color of a movie clip. To use these methods, we first create
a
Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.