/ Published in: ActionScript 3
                    
                                        
Draws arc on the inner side of the square (all sides).
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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 )
Comments
 Subscribe to comments
                    Subscribe to comments
                
                