2
ActionScript에서 원으로 텍스트를 포함하고 싶습니다. 세 가지 문제가 있습니다. 텍스트를 가운데에 가운데 놓을 수 없으며 가운데 맞춤 텍스트를 가져올 수 없으며 글꼴을 텍스트에 적용 할 수 없습니다. 글씨체에 관해서는, 그것이 정확하게 임베디드되어 있다는 것을 알고 있습니다. 나는 무대에서 만듭니다. TextField
에서 작동합니다.도형에 텍스트 포함
[Embed(source="DAXCOMPL.TTF", fontName="DaxCompact-Light", mimeType='application/x-font', embedAsCFF='false')]
private var MyFont:Class;
public function Bubble(...) {
var myFont:Font = new MyFont();
var myFormat:TextFormat = new TextFormat();
myFormat.size = 20;
myFormat.align = TextFormatAlign.CENTER;
myFormat.font = myFont.fontName;
var circle:Sprite = new Sprite();
var r:int = 30;
var text:TextField = new TextField();
text.text = "Hello world!";
text.wordWrap = true;
text.defaultTextFormat = myFormat;
text.autoSize = TextFieldAutoSize.LEFT;
text.x = -30;
text.y = -30;
circle.graphics.lineStyle(2, 0x000000, 1.0);
circle.graphics.drawCircle(0,0,r);
circle.graphics.endFill();
circle.addChild(text);
circle.x = 75;
circle.y = 450;
addChild(circle);
}
미안하지만, 이것은 (수직으로 내 텍스트를 정렬 내 글꼴을 적용) 내 세 가지 문제 중 두 가지를 해결했다. 그러나 텍스트는 여전히 모양의 중심에 정렬되지 않습니다. 항상 오른쪽으로 너무 멀리 떨어져 있습니다. 이 방법이 효과가 있습니까? –