
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
112
|
Chapter 4: Classes
<ARG>value 2</ARG>
...
<ARG>value n</ARG>
</MESSAGE>
The sendMessage( ) method defines no parameters. Instead, it retrieves all its argument
values via the
arguments object. Any number of arguments can be passed to
sendMessage( ); each one becomes the content of an
<ARG> tag in the XML message sent.
As a point of interest, the
arguments object also stores:
• A reference to the method currently executing (
arguments.callee)
• A reference to the method that called the method currently executing, if any
(
arguments.caller)
Note that
arguments.callee is not the same as this. The latter refers to the object on
which the method is invoked, whereas the former is a reference to the current
method itself.
For details, see ActionScript for Flash MX: The Definitive Guide (O’Reilly).
Constructor Functions (Take 2)
We’ve done pretty well with our example Box class. We’ve given it methods to
invoke and properties to examine and change. Now it’s time to return to our Box
constructor function, which we introduced much earlier in this chapter under “Con-
structor Functions (Take 1).”
Suppose we want to make every Box instance we create start out with a width and
height of 1. We need something that can set each new Box instance’s
width and
height properties during the instance-creation process. ...