Hi,
I’m using mcs from my swf library as simple level templates and need to read custom class names of nested objects.
This worked pretty well until I updated Haxe, OpenFl and Lime to recent versions.
var obj:Dynamic = levelDesign.getChildAt(i);
var oType:String = Type.getClassName(Type.getClass(obj));
Now it returns openfl.display.MovieClip instead of custom class names.
Am I missing something? Nothing I found on the internet seemed to work, and as it’s super convenient, I wouldn’t like to use instance names…
Thank you! Yes, seems to be a similar problem and helped a lot to look at the right spots.
But I think the information is already there and we just need a proper way to get it…?
When iterating over 9 nested mcs, this
/* if(Std.isOfType(obj, Door)){
Log.debug("Yay, I found a door!");
} */
Log.debug("oType: " + Type.getClassName(Type.getClass(obj)));
returns 9 x “oType: openfl.display.MovieClip” (like also Lib.getQualifiedClassName(obj); etc.).
But this
if(Std.isOfType(obj, Door)){
Log.debug("Yay, I found a door!");
}
Log.debug("oType: " + Type.getClassName(Type.getClass(obj)));
returns not only “Yay, I found a door!”, but also 1x “oType: Door” (!) and 8 x “oType: openfl.display.MovieClip”.
Any ideas what’s happening here, and what could be a better way to access custom classes instead of type testing each of them with Std.isOfType()…?