jeudi 31 décembre 2015

Is it possible to get the class or class name from inside a function?

I'm trying to write debugging tools and I would like to be able to get the class name of the caller. Basically, caller ID.

So if I have a method like so, I want to get the class name:

public function doSomething():void {
   var object:String = argument.caller.this;
   trace(object); // [Class MyClass]

public class MyClass {

   public function method1 {

Is there anything like this in JavaScript or ActionScript3? FYI AS3 is based on and in most cases interchangeable with JS.

Aucun commentaire:

Enregistrer un commentaire