Skip to main content
Participating Frequently
September 2, 2007
Answered

Help - Flash 8 graphics bug w/ transparency and Drawing API

  • September 2, 2007
  • 3 replies
  • 246 views
Hi,

I was wondering if anybody has a workaround for this bug?

When I use the Drawing API to create a filled circle in a new MovieClip (using the drawCircle function defined in the docs), and then set the new clip to 50% alpha, half of the stroke is set to 100% alpha. It's easy to reproduce, just stick the following in a new flash doc and you'll see what I mean:

createEmptyMovieClip("a", 10);
this.a._x = 50;
this.a._y = 50;
this.a._visible = true;
this.a._alpha = 50;
this.a.lineStyle(10, 0xFF0000, 100);
this.a.beginFill(0x888888, 100);
drawCircle(a, 50, 50, 50);
this.a.endFill();

function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void
{
// Taken directly from the Flash documentation
mc.moveTo(x+r, y);
mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x,
Math.sin(Math.PI/4)*r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x,
Math.sin(Math.PI/4)*r+y);
mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x,
-Math.sin(Math.PI/4)*r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x,
-Math.sin(Math.PI/4)*r+y);
mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}

You can see it looks like there are two strokes instead of one. This is a very serious bug in my graphics and I don't know how to get around it! Does anybody have any advice?

I'm using Flash 8.

Much thanks
Michael
This topic has been closed for replies.
Correct answer kglad
1/2 the stroke is overlapping with the fill. to remedy, create your stroke "outside" the fill. ie, draw the stroke with the same center but with a radius increased by 1/2 the stroke width.

3 replies

kglad
Community Expert
Community Expert
September 2, 2007
you're welcome.
Participating Frequently
September 2, 2007
OK, I understand now why it is creating this look... The workaround is a bit annoying, but at least it's possible...

Thank you!
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 2, 2007
1/2 the stroke is overlapping with the fill. to remedy, create your stroke "outside" the fill. ie, draw the stroke with the same center but with a radius increased by 1/2 the stroke width.