07May
Round Rectangle with Actionscript
No commentsA class to generate a rounded cornered rectangle which I am using in one of my current projects:
package {
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
public class RoundRectangle extends Sprite {
private var rrX:Number;
private var rrY:Number;
private var rrRadius:Number;
private var rrWidth:Number;
private var rrHeight:Number;
private var bgColor:uint;
private var borderColor:uint;
private var borderSize:Number;
private var child:Shape = new Shape();
public function RoundRectangle(rrX:Number=0,rrY:Number=0,rrWidth:Number=10,rrHeight:Number=10,rrRadius:Number=0,bgColor:uint=0x000000)
{
child = new Shape();
child.graphics.beginFill(bgColor);
child.graphics.lineStyle(borderSize, borderColor);
child.graphics.drawRoundRect(rrX, rrY, rrWidth, rrHeight, rrRadius);
child.graphics.endFill();
addChild(child);
}
}
}
Categories: Actionscript 3, Drawing API
Wednesday, May 7th, 2008 at 9:50 am and is filed under Actionscript 3, Drawing API. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.