I've recently started to play a bit with the Graphics.curveTo function, and have been pulling my hairs out since this afternoon because of some unexpected result:
I've been able to reproduce this weird behavior to a simple case: On a canvas, I draw a curve starting at (0, 0), ending at (width, height) with some arbitrary control point (in my case it was (0, height)). After drawing the curve, I draw & fill a circle at some other point on the canvas (in my case (width / 2, height / 2) with radius 25). What I'm seeing after these commands is that the entire application area that lies to the right of the curve is colored in a color slightly darker than the application background, and that my circle ends up being partly colored black, and partly the same color as the application background.
Here's the code:
g.curveTo(0, canvas.height, canvas.width, canvas.height);
g.drawCircle(canvas.width / 2, canvas.height / 2, 25);
Here's a picture showing the result:
Now, the weird thing is that when adding the statement "g.moveTo(0, 0)" after the curveTo call fixes the problem:
The way I'm interpreting all this is that the beginFill call after drawing the curve makes flex / flash perform some kind of fill of the curve, but I have no clue as to why it's filling to the right edge of the screen. I'm even more puzzled about why the g.moveTo(0, 0) solves the problem - I've tried moving the pen to other coordinates, and actually they all work, so it's not about moving the pen back to the beginning of the curve.
Has anybody stumbled upon similar behavior or can someone explain to me what goes on inside flex' drawing mechanisms that explains this behavior?