Create hole in shape

Hi.
How i can make hole in Shape ? In flash like

var gg = new Shape();
addChild(gg);
		
gg.graphics.beginFill(0xff0000);
gg.graphics.drawRect(0, 0, 500, 500);
gg.graphics.drawRect(100, 100, 100, 100);

And now in big rect - small rect hole.

Thanks for advice.

I’m honestly more confused as to why it works in flash, rather than why it doesn’t in other targets… I’ve always thought of drawRect call as 1 moveTo call and 3 lineTo calls. My guess is that they specifically do something here to allow this usage.

for now you can just do:

var gg = new Shape();
addChild(gg);
		
gg.graphics.beginFill(0xff0000);
gg.graphics.moveTo(0, 0);
gg.graphics.lineTo(500, 0);
gg.graphics.lineTo(500, 500);
gg.graphics.lineTo(0, 500);
gg.graphics.lineTo(0, 0);

gg.graphics.lineTo(100, 100);
gg.graphics.lineTo(200, 100);
gg.graphics.lineTo(200, 200);
gg.graphics.lineTo(100, 200);
gg.graphics.lineTo(100, 100);