
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
20
|
Chapter 1: A Gentle Introduction for Nonprogrammers
objects, our program’s conceptual model is reflected by an intuitive syntax that looks
like this:
room.addBall( );
ball.diameter = 5;
ball.startMoving( );
In general terms, the object (noun) comes first, followed by a dot (.), followed by
either a function (verb) or a variable (adjective). The function does something to the
object, while the variable tells us something about the object. Functions associated
with an object are often called methods. Variables associated with an object are often
called properties. Here are some examples:
object.method();
boy.run( );
someMovieClip.play( );
object.property = value;
boy.speed = 5;
someMovieClip._width = 60;
Object-oriented programming (OOP) is an approach in which objects are the funda-
mental building blocks of a program. There are, however, varying degrees of OOP
depending on the language and the developer’s taste. Purists insist that every part of
a program should be contained by an object (this rule is enforced by the Java pro-
gramming language). Others are happy using objects to structure only certain parts
of a program (this is common in ActionScript).
Regardless, you should become familiar with objects, because they are intrinsic to
ActionScript’s makeup. Nearly everything in Flash—from ...