View comments | RSS feed

caller (arguments.caller property)

public caller : Object

A reference to the function that called the currently executing function, or null if it wasn't called from another function.

Availability: ActionScript 1.0; Flash Player 6

See also

callee (arguments.callee property)


Version 8

Comments


thx1138 said on Sep 30, 2005 at 8:16 AM :
Can you specify in the documentation if the caller property can return a reference to the name of the function?

trace(arguments.caller) // traces nameOfFunction
thx1138 said on Sep 30, 2005 at 9:13 AM :
An example of how you can use this until Macromedia makes one.

function firstFunction () {
trace("calling first function")
secondFunction();
}

function secondFunction () {
trace("calling second function")
if (arguments.caller==firstFunction) {
trace("second function called by first function")
}
else {
trace("second function called by third function")
}
}

function thirdFunction() {
trace("calling third function")
secondFunction()
}

//firstFunction()
thirdFunction()
Leandro Amano said on Jul 16, 2007 at 10:54 AM :
import mx.utils.Delegate;
var oRel:Object = btn.onRelease=Delegate.create(this, getDesc);
function getDesc() {
trace(arguments.caller == btn.onRelease);
trace(arguments.callee == getDesc);
trace(arguments.caller.name);
}
oRel.name = "btn";

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00001899.html