Troubleshooting SWF movieClip error appearing in console

Greetings,

New OpenFL developer here. I’m trying to ramp up on OpenFL and Haxe so that I can help my company transition over from Flash (looking at many options currently) for what we do. I’ve been putting together some animations and interactive elements based on keyboard and mouse presses. However the main element of my project is a SWF file that I loaded in. When I’m looking at the console in my browser, it continuously updates with this error:

MovieClip.hx:699: Error evaluating frame script
TypeError: Cannot read property ‘_mask_obj_instance’ of null

My SWF file contains two identically structured movieClips that I’m importing into my project. Within each movieClip are four layers. Two layers are masks and the other two masked layers contain PNG files. There is no actionScript in the file. Not even a stop();

This error doesn’t break anything, my project runs just fine. However, I do not like having an error I can’t sort out. It’s messy. Also, it makes it difficult to troubleshoot other issues as it keeps updating my Console with error messages.

Has any of you encountered this error, and if so, maybe you could point me in the direction of a solution.

Deeply appreciated.

As a test, I removed my two mask layers. That cleared the TypeError, however a new TypeError has been introduced as a result…

MovieClip.hx:699: Error evaluating frame script
TypeError: this.applyLayerZdepthAndEffects is not a function

EDIT::

I added a stop(); to the end of the timeline of both movieClips. The error comes up once at the very beginning (when everything loads) but does not return. This tells me that whatever triggers the error happens every time the playhead loops.

Does this occur when targeting Flash, or targeting HTML5?

Are you sure there is no code that references this.applyLayerZdepthAndEffects? It would be strange if this appeared otherwise.

Do you load the SWF using openfl.display.Loader, or are you using it as an OpenFL SWF library?

I just combed through the Animate FLA file. There is no script at all in it. Just a movieclip with 4 layers and a timeline. Two layers are mask layers, the other two are layers containing movieClips that have PNG images in them. One of the layers animates along the timeline and the other is static. None of the movieClips have a stop(); in them, so they just loop when run.

As for how I load it into my project. I’ve mapped an Assets folder in my project.xml file. In that folder I’ve placed the FLA and SWF files. Then my Main.hx code to load it looks like this:

orbBlue = Assets.getMovieClip ("orb_library:orb1_standing_animation");
orb.addChild( orbBlue );

When I click the Test Project (F5) button in HaxeDevelop, it publishes to an Export / HTML5 folder and opens it in my Chrome browser. It runs just fine. When I view the Console, I do see this error:

MovieClip.hx:699: Error evaluating frame script
TypeError: Cannot read property '_mask_obj_instance' of null

In front of the error is a number that increments after a brief pause. I’ve determined that every time the SWF file loops, the error increments. I’ve determined this by testing it with a stop(); at the end of the SWF timeline. When I run that test, the error only appears once, but the counter for it doesn’t increment.

Hmm, perhaps the SWF file that’s loaded has a class name that is similar to one in your root project. Perhaps it is actually running the main code from your project twice?

That does make sense, but as I’ve just started this project, there isn’t anything here that I can see would cause this to run the main code twice.

I built this off of an openfl sample/demo file and have only changed out code where it imports a cat animation from the original demo file with one that I built. Just to see how it works. Now that I’m trying to build on top of that I realize I should make sure that I haven’t got any errors that could mess me up later.

Does it work in HTML5?

Do you think there is a chance you could share your project, so I could give it a try?

Does the “NyanCat” sample work for you in Flash without errors?

When I run NyanCat, there are no errors. Just this warning message:
The Web Audio autoplay policy will be re-enabled in Chrome 71 (December 2018). Please check that your website is compatible with it.

Here is a link to a zip file of what I’ve been doing:

Thank you for your help on this. I do appreciate it.

Are you getting the same result that I am?

Thanks for the sample!

Yes, it appears that we have code that is trying to parse ActionScript 2 sources from your SWF, and it is resolved to JavaScript that looks like this:

null._mask_obj_instance = null._mask_obj_instance;
this["___layerDepthEnabled___"] = true;
this.applyLayerZdepthAndEffects();
this.addEventListener(flash.events_Event.ADDED, this.___onAdded___);

As you can see, null._mask_obj_instance is not going to work.

I added code to the “develop” branch of OpenFL that will discard scripts with null. references, which fixes the error on your sample. You might want to check, though, if this code is something you want running? There appears to be a privatePkg.__LayerProp__ class that might be related to some of the underlying ActionScript code?

I knew something fishy was going on there. Thanks for helping me troubleshoot this.