Return to Snippet

Revision: 47885
at June 17, 2011 18:53 by siaukia


Initial Code
var rect:Rectangle = new Rectangle( 100, 100, 200, 150 );
var mc:MovieClip = new MovieClip();

// draw Arc 1
mc.graphics.beginFill(0x00FF00, 1);

mc.graphics.moveTo(rect.x, rect.y);
mc.graphics.lineTo(rect.x + (rect.width / 2), rect.y);
mc.graphics.curveTo(rect.x, rect.y, rect.x, rect.y + (rect.height / 2)); 
// draw arc 2
mc.graphics.moveTo(rect.x + rect.width, rect.y);
mc.graphics.lineTo(rect.x + (rect.width / 2), rect.y);
mc.graphics.curveTo(rect.x  + rect.width, rect.y, rect.x + rect.width, rect.y + (rect.height / 2));
// draw arc 3
mc.graphics.moveTo(rect.x + rect.width, rect.y + rect.height);
mc.graphics.lineTo(rect.x + rect.width, rect.y + (rect.height / 2));
mc.graphics.curveTo(rect.x + rect.width, rect.y + rect.height, rect.x + (rect.width / 2), rect.y + rect.height);
// draw arc 4
mc.graphics.moveTo(rect.x, rect.y + rect.height);
mc.graphics.lineTo(rect.x, rect.y + (rect.height / 2));
mc.graphics.curveTo(rect.x, rect.y + rect.height, rect.x + (rect.width / 2), rect.y + rect.height);
mc.graphics.endFill();

addChild( mc )

Initial URL
http://www.manmeng.net

Initial Description
Draws arc on the inner side of the square (all sides).

Initial Title
Draw an Arc inside a Square

Initial Tags


Initial Language
ActionScript 3