Starling canvas mask not working

Trying to create a mask with a canvas in Starling 2.5.1 in html5. It doesn’t work and just creates a black box and doesn’t mask any object. If I take the fill out it is a white box. This used to work on an older version of Starling 2. Any ideas?

    var baseContainer:Sprite = new Sprite();
    baseContainer.width = _width;
    baseContainer.height = _height;

    var maskCanvas:Canvas = new Canvas();
    maskCanvas.drawRectangle(0,0,_width, _height);
    baseContainer.mask = maskCanvas;

Would you mind seeing if the Starling demo is working for you?

I just tried here and it seems to be working fine and use similar code in the mask test

Try to add to project file
<window depth-buffer="true" if="html5" />
If don’t help also
<window stencil-buffer="true" />

1 Like

Thanks for the replies!

Adding this to project file worked.