1

Yes, I am new to Actionscript/Flex/Flash, but I'd really like to call something like C/C++/PHP/etc magic constants like:

__FUNCTION__
__LINE__
__FILE__

Is there an equivalent in Actionscript 3.0? When compiling, I get the error:

Error: Access of undefined property __FUNCTION__.
randomx
  • 2,357
  • 1
  • 21
  • 30

1 Answers1

3

There is a special object named arguments accessible in each function. It can be used to get arguments (as the name already implies):

arguments[0] // first argument

It can also be used to get you a reference to the called function:

arguments.callee

In earlier Actionscript versions there it also had a caller property, but not in AS3 any more.

There is a way to get the name of a function using the callee property: Actionscript - Obtain the name of the current function

Community
  • 1
  • 1
kapex
  • 28,903
  • 6
  • 107
  • 121
  • This may be as close as it gets for AS3. +1 – randomx Sep 02 '11 at 21:07
  • Side note: `arguments[0]` will online work **inside** a function block that has at least one parameter. Just some clarification for those that are really really new. +1 for being more enlightened than me. – Jacksonkr Sep 03 '11 at 15:17