Actionscript 2:创建自定义形状

Actionscript 2 : Creating Custom Shapes

我需要一些关于在 Actionscript 2 中创建自定义形状的帮助,我想创建一个圆角矩形,仅使用代码。我希望能够指定每个角上我想要多少曲线。如果那是可能的..我知道它在 Actionscript 3 中是可能的..但是我没有太多地进入 actionscript 2..所以我的问题是..我如何在 Actionscript 2 中使用自定义角制作一个圆角矩形只使用代码?我需要自定义曲线的原因是我希望能够使矩形的顶部完全呈正方形,而底部具有圆形边缘,在此先感谢

想通了..感谢一些研究只是不得不修改

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();

代码来源:How can i draw a round rectangle as2

我所做的更改在这里

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();