[HTML5] Openfl swf library mask effect

Hi guys.

I have a big problem with the SWF library.

I have an animation under a mask. if i export the swf with animation and double click on it, it work great.
But when i load and build it with my openfl application, the mask effect doeasn’t work.
Can you help me?

Thanks

What platform are you targeting?
Does your mask is different than a square or rectangle?

I’m using openfl for create a html5 game.

I have tried my animation( an arm that move under a body ) and for confirm this issue, also a normal square that move under a square mask. nothing work

If masking doesn’t work directly, try setting scrollRect.

animation = Assets.getMovieClip("library:Animation");
addChild(animation);

mask = new Rectangle(0, 0, 100, 100);
animation.scrollRect = mask;

Then, if you want to move the mask:

mask.x = 300;
mask.y = 100;

//Only required in Flash.
animation.scrollRect = mask;

//Optional, depending on how you want the mask to work.
animation.x = mask.x;
animation.y = mask.y;

I remember some bugs on swf/html5 with mask. Avoid non square mask, rotation and scale on the mask if possible. Also you can try to make the mask by code.

If you force type="swflite", the format will be the same on both the Flash target as well as elsewhere. That allows us to separate the differences between SWF parsing and rendering. It’s possible SWFLite is working properly, but we do not have full support for the mask in our OpenGL renderer at the moment. You can also try -Dcanvas or -Dcairo (depending on if you are trying HTML5 or native) to force a software renderer – which tends to handle masks better

OMG IT WOOOOOOOOORKS!!!

thx a lot!!! :smiley: