AS3 Get current class name from static method

I need to read the current class name inside a static method. For a non-static method, it's easy to just call getQualifiedClassName (this), but inside the static method this is not valid. Any idea?

thanks

+4
source share
2 answers

You can use getQualifiedClassName (prototype.constructor) in a static class method

+7
source

You have no direct way to do this. If it is inside the same class that you need, you can try adding a static element containing a reference to the class.

static private const CLASS:Object = YourReflectedClass; 

then just use this in your static method:

 protected static function doReflection(): void { var className:String = getQualifiedClassName(CLASS); } 

It would be helpful to know more about usage and customization.

+1
source

Source: https://habr.com/ru/post/1345760/


All Articles