Does Actionscript have something like magic constants?
Yes, I am new to Actionscript/Flex/Flas开发者_运维技巧h, 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__.
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
精彩评论