Reputation: 75
I Need some help with Creating Custom Shapes in Actionscript 2, I Want to Create a Rounded Rectangle , Using only code.. I Want to be able to specify how much of a curve i want on each corner.. if thats possible.. I Know its possible in Actionscript 3.. but i didnt get into actionscript 2 much.. So my question is .. How do i make a rounded rectangle in Actionscript 2 with custom corners using nothing but code? Reason i need the custom curves is i want to be able to make the top of the rectangle completely square and the bottom have rounded edges, Thanks in Advance
Upvotes: 1
Views: 497
Reputation: 75
Figured it out.. Thanks to some Researching Just had to modify
function drawRoundedRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
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();
Source of Code : How can i draw a round rectangle as2
The Changes i made are here
beginFill(fillColor, fillAlpha);
moveTo(cornerRadius, 0);
lineTo(boxWidth, 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); lineTo(0, 0);
endFill();
Upvotes: 1