OpenFL 6.1.0 bug, can't get frame maske object HTML5

@singmajesty I found bug in OpenFL 6.1.0, when loading asset from swf and trying to get mask object I am getting error. target: HTML5

Stage.hx:1207 Uncaught TypeError: Cannot set property 'height' of null
    at DocumentClass.Main [as __class__] (Main.hx:24)
    at DocumentClass [as __class__] (ApplicationMain.hx:290)
    at Function.ApplicationMain.start (ApplicationMain.hx:194)
    at Array.tmp (ApplicationMain.hx:95)
    at lime_app__$Event_$Void_$Void.dispatch (EventMacro.hx:101)
    at openfl_display_Preloader.start (Preloader.hx:250)
    at openfl_display_Preloader.display_onUnload (Preloader.hx:114)
    at openfl_events__$EventDispatcher_Listener.f [as callback] (TouchData.hx:33)
    at openfl_display_DefaultPreloader.__dispatchEvent (EventDispatcher.hx:217)
    at openfl_display_DefaultPreloader.__dispatchEvent (DisplayObject.hx:414)

this is code and sample swf file


import openfl.display.Sprite;
import openfl.Assets;

class Main extends Sprite {
	public function new () {
		super ();

		var mov = Assets.getMovieClip ("library:MaskedMv");
		var getMask = cast mov.getChildByName('masked');
		getMask.height = 10;


Does it work if you remove the cast?

Nevermind, I guess it is coming back as null

no it does’t result is null

This might not be the problem in this case, but this still bugs me. You’re using cast without telling Haxe what to cast it to. This can make the compiler fail to notice errors, and Haxe will use reflection to access the properties, which is slightly slower.

It can also prevent you from setting certain variables, including height. But if that was happening here, you’d see a different error message.

Even if it won’t fix your problem here, just type out getMask:MovieClip (or whatever class), and you could save yourself future headaches.

var getMask:MovieClip = cast(mov.getChildByName(‘masked’), MovieClip);

I have tried with all variations, but result is the same.

in OpenFL 5.1.5 and Lime 5.2.1 works as expected

Ok, so it is a different issue. As I said, you’d get a different error if that was the problem.

I still recommend this because of the “future headaches” thing.

Thanks, I’ve created an issue

The MovieClip edits in a recent release stopped adding masks as children to the parent object. We’ll try and get this resolved in the next pass

@singmajesty Hi, when do you plan to fix this bug?

I got reports that our previous MovieClip logic resulted in rendering issues, and received a large pull request with a rewrite which was said to improve performance and accuracy. The rewrite lost this feature with masks, and I am hesitant to add it in quickly, for fear of reverting some case where masks where rendering when they shouldn’t have. Ultimately, it comes down to needing to track the display list hierarchy for the animation separately from the actual display list – which enables the addition of masks or custom objects without disrupting the animation.

@singmajesty for this bug I can’t port project to OpenFL 6 (((((( for me this is very critical issue
lot of project have to move from flash to OpenFL/HTML5