I need draw rectangle with two circle holes inside. The problem is in circles interception. I want them to join together and cut from background, but they seems to be XORed:

At first I tried drawRect and DrawCircle:
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, width, height);
graphics.drawCircle(width/2, height/2, 50);
graphics.drawCircle(width/2-30, height/2-30, 50);
graphics.endFill();
Then I switched to drawPath, but no luck too:
graphics.beginFill(0, 0.5);
var c1:Object = getCirclePath(width/2-30, height/2-30, 50);
var c2:Object = getCirclePath(width/2, height/2, 50);
graphics.drawPath(new <int>[
GraphicsPathCommand.MOVE_TO, GraphicsPathCommand.LINE_TO,
GraphicsPathCommand.LINE_TO, GraphicsPathCommand.LINE_TO,
GraphicsPathCommand.LINE_TO],
new <Number>[0, 0, myCanvas.width, 0, myCanvas.width, myCanvas.height,
0, myCanvas.height, 0, 0]);
myCanvas.graphics.drawPath(c1.commands, c1.data);
myCanvas.graphics.drawPath(c2.commands, c2.data);
graphics.endFill();
here getCirclePath returns object with points to draw polygon which looks like circle. Also I tried different combinations of GraphicsPathWinding constants, but no luck.
Any suggestions how to draw two intersecting circle holes in graphics?
If you want to draw more than one circle without the paths that cross each other “XOR”-ing, you should
beginFill(...)andendFill()per shapes that you draw.I haven’t tested, but that would be my guess to properly render overlapping shapes.
— EDIT —
link to demo: http://bit.ly/vBW1ag
How about using blendmodes?
Try to set your scene up like this:
BlendMode.LAYER;BlendMode.ERASE;Once you start Tweening them, you should get the animated effect.
See the below example (you can toss it into a new project to see it running)