Actionscript 2:创建自定义形状

时间:2016-10-25 22:02:45

标签: flash actionscript

我需要一些帮助在Actionscript 2中创建自定义形状,我想创建一个圆角矩形,仅使用代码..我希望能够在每个角上指定我想要多少曲线...如果可能的话..我知道它可能在Actionscript 3 ..但我没有进入动作脚本2 ..所以我的问题是..如何在Actionscript 2中使用自定义角落使用除了代码之外的任何东西?我需要自定义曲线的原因是我希望能够使矩形的顶部完全正方形而底部具有圆形边缘,在此先感谢

1 个答案:

答案 0 :(得分:1)

想出来..感谢一些研究只需要修改

graphics

守则来源:How can i draw a round rectangle as2

我所做的改变就在这里

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();
相关问题