curveTo
タスクは、グラフィックス メソッドを使用してカスタム シェイプを描画することです。
問題は、パスの結合が正確でないことです。
結果は次のとおりです。
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
test.graphics.clear();
test.graphics.lineStyle(1);
drawBorder(test.graphics, 200, 200);
}
private function drawBorder(g: Graphics, width: Number, height: Number): void
{
var cornerRadius: int = 20;
var pointerWidth: int = 4;
var pointerHeight: int = 10;
var pointerBottomGap: int = 6;
width -= pointerWidth;
g.moveTo(0, height - cornerRadius);
g.lineTo(0, cornerRadius + 1);
g.curveTo(0, 0, cornerRadius, 0);
g.lineTo(width - cornerRadius, 0);
g.curveTo(width, 0, width, cornerRadius);
var pointerY: int = height - pointerHeight - pointerBottomGap;
g.lineTo(width, pointerY);
g.lineTo(width + pointerWidth, pointerY + pointerHeight);
g.lineTo(width - pointerWidth, pointerY + pointerHeight + 1);
g.curveTo(width - pointerWidth, height, width - cornerRadius, height);
g.lineTo(cornerRadius, height);
g.curveTo(0, height, 0, height - cornerRadius);
}
]]>
</fx:Script>
<mx:UIComponent
id="test"
x="100" y="100"/>
質問は言い換えることができます - メソッドを使用してコーナー半径で四角形を描くcurveTo
方法は?