Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

simpleCircle.as

1
2
3
4
5
6
7
8
9
10
11
12
13
_global.simpleCircle = function(mc, x,y, r, lstyle, fstyle) {
	var r2 = r*2;
	// lstyle and fstyle are arrays of lineStyle and beginFill arguments respectively
	if (lstyle) mc.lineStyle.apply(mc, lstyle);
	if (fstyle) mc.beginFill.apply(mc, fstyle);
	mc.moveTo(x-r, y-r);
	mc.curveTo(x, y-r2, x+r, y-r);
	mc.curveTo(x+r2, y, x+r, y+r);
	mc.curveTo(x, y+r2, x-r, y+r);
	mc.curveTo(x-r2, y, x-r, y-r);
	if (fstyle) mc.endFill();
	return mc;
};