
Function Class
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
528
|
ActionScript Language Reference
Function Class
object-oriented representation of ActionScript functions
Flash 6
Properties
prototype An object specifying methods and properties for a class.
Methods
apply() Invoke a function as an object method, passing parameters in an array.
call() Invoke a function as an object method.
toString() Returns a string representation of the function object.
Description
In ActionScript, every function, both user-defined and built-in, is an instance of the Func-
tion class. As an object, every function can have properties and methods, and every
function can be stored, passed, and compared as ActionScript data. While functions-as-
objects is a foreign (and perhaps strange) concept to some programmers, it is a core
component of the ECMA-262 implementation of object-oriented programming. In Action-
Script, every function has the potential to be used as a class constructor. Hence, every
function defines a
prototype property specifying the methods and properties that will be
inherited by the instances of the class. Furthermore, every function has the potential to be
used as a method. Hence, every function can be stored as an object property (defining it as
a method for that object). These and other uses of functions in ActionScript’s inheritance
system ...