A 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);
}
}
}
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.