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:
http://try.haxe.org/#6A196
class Test {
static function main() new Test();
function new()
{
var className = Type.getClassName(Type.getClass(this));
trace('Current class name = $className');
}
}
Also see: http://api.haxe.org/Type.html#getClassName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With