this.createEmptyMovieClip("my_rectangle_mc",
10);
my_rectangle_mc._x = 75;
my_rectangle_mc._y = 75;
drawRoundedRectangle(my_rectangle_mc, 240,
180, 20, 4, 0x999999, 100, 0xFF9900, 100);
function drawRoundedRectangle(target_mc:MovieClip,
boxWidth:Number, boxHeight:Number, cornerRadius:Number,
lineHeight:Number, lineColor:Number, lineAlpha:Number,
fillColor:Number, fillAlpha:Number):Void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
lineStyle(lineHeight, lineColor, lineAlpha);
moveTo(cornerRadius, 0);
lineTo(boxWidth - cornerRadius, 0);
curveTo(boxWidth, 0, boxWidth, cornerRadius);
lineTo(boxWidth, cornerRadius);
lineTo(boxWidth, boxHeight - cornerRadius);
curveTo(boxWidth, boxHeight, boxWidth - cornerRadius,
boxHeight);
lineTo(boxWidth - cornerRadius, boxHeight);
lineTo(cornerRadius, boxHeight);
curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
lineTo(0, boxHeight - cornerRadius);
lineTo(0, cornerRadius);
curveTo(0, 0, cornerRadius, 0);
lineTo(cornerRadius, 0);
endFill();
}
}
|