How would I get the class name in string?
I tried this:
Type.getClassName(this));
Where this is the current class I am in, but I got error:
com.SubWidget should be Class<Dynamic>
Any help?
How would I get the class name in string?
I tried this:
Type.getClassName(this));
Where this is the current class I am in, but I got error:
com.SubWidget should be Class<Dynamic>
Any help?
You should pass a Class
to Type.getClassName
. So, first grab that using Type.getClass
, like this:
class Test {
static function main() new Test();
function new()
{
var className = Type.getClassName(Type.getClass(this));
trace('Current class name = $className');
}
}
© 2022 - 2024 — McMap. All rights reserved.
this.getClass().getName()
– Indreetloire