About functions and methods 203
For more information on passing parameters, see “Passing parameters to a function”
on page 218.
There are numerous kinds of functions that you can write. For more information on writing
functions, as well as links to sections on writing specific kinds of functions, see “About types
of methods and functions” on page 203. For an example that compares methods and
functions, see “Understanding methods” on page 222.
For more information about functions and methods, see the following topics:
■ “About types of methods and functions” on page 203
About types of methods and functions
Functions that belong to a class are called the methods of that class. There are several types of
functions that you can use in your applications, including built-in functions, named and user-
defined functions, anonymous functions, callback functions, constructor functions, and
function literals. The following sections contain information on how to define these
functions.
You can also write functions in an ActionScript class file. You use these functions as methods
in your scripts. In the following example, the Person class displays a constructor method, class
methods, instance methods, and accessor methods (getters and setters). The comments in this
code sample show where these methods occur in the code.
NOTE
For information on writing code using Script Assist, see “Using Script Assist to write
ActionScript” on page 328, “Creating a startDrag/stopDrag event using Script Assist”
on page 331 and the ActionScript:Use Script Assist Mode tutorial (which begins with
“Open the starter document” on page 213).
NOTE
For information on writing class files, such as the following, see Chapter 7, “Classes,” on
page 225.