Marc Hughes


Home
Blog
Twitter
LinkedIn
GitHub
about
I am a developer from a bit west of Boston.

AS3 Drawing API oddity

07 Jun 2007

I have a weird bug that I'm having trouble figuring out. I have the following code:

comp.graphics.clear();
comp.graphics.lineStyle(5, 0x888888);
comp.graphics.moveTo(0,0);
comp.graphics.lineTo(0,50);
comp.graphics.lineStyle(0, 0);
comp.graphics.beginFill(0x188888);
comp.graphics.drawCircle(10,10,5);
comp.graphics.endFill();

I would expect that to draw a vertical grey line with a filled in circle to the right of it. What I actually get is this:



It's like flash is drawing my circle and then doing a flood-fill outside the circle instead of inside it like it should. If I remove the call to drawCircle(), I get similar results but without the circle.

My solution was to draw the line and the circle on different objects, but I'm unclear on why this is necessary.