Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

as3: draw circle with a hole in it using only actionscript

Okay so basically I want to draw a circle in as3 that has a 'hole' in it (like a donut). Something like this, but without the outlines:

http://www.steel.ie/DugganSteel/Pictures/Hollow-circle.gif

This doesn't work:

SPRITE.graphics.beginFill(0xFFFFFF);
SPRITE.graphics.drawCircle(0,0,10);
SPRITE.graphics.endFill();
SPRITE.graphics.drawCircle(0,0,5);

I mean this seems like it'd be simple but I can't find any information on it. I should also mention that I'm trying to only draw 3/4 of the circle, like 3/4 of donut. So I was planning on drawing a transparent circle and square over the original circle, I know this seems kinda of weird since you'd expect something transparent to show whats underneath it.

like image 715
user421215 Avatar asked Sep 02 '10 18:09

user421215


1 Answers

Its actually really simple. See the following code:

var p:Point = new Point(100, 100);
graphics.beginFill(0xFF0000);
graphics.drawCircle(p.x, p.y, 100);
graphics.drawCircle(p.x, p.y, 50);

Intersections cancel each other out until you call endFill

Goodluck!

like image 94
Tyler Egeto Avatar answered Sep 19 '22 18:09

Tyler Egeto