
arguments.caller Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
441
arguments.callee Property
a reference to the function being executed
Flash 5
read/write
arguments.callee
Description
The callee property stores a reference to the function currently executing. We can use this
reference to execute the current function again or to identify the current function through
comparison.
Example
function someFunction () {
trace(arguments.callee = = someFunction); // Displays: true
}
// An unnamed recursive function
countToTen = function () {
i++;
trace(i);
if (i < 10) {
arguments.callee();
}
};
// Invoke the unnamed recursive function
countToTen();
arguments.caller Property
a reference to the calling function
Flash 6
read/write
arguments.caller
Description
The caller property stores a reference to the function that called the current function. If
the current function was not called by another function,
caller is null. For example:
// Create a function that calls two other functions
function formatPage () {
formatTitle();
formatBody();
}
function formatTitle () {
// Check if the function was called by formatPage()
trace(arguments.caller = = formatPage);
}
function formatBody () {
// Check if the function was called by formatPage()
trace(arguments.caller = = formatPage);
}