ActionScript 3 As3:向Label组件添加字体(fl.controls.Label)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 As3:向Label组件添加字体(fl.controls.Label)相关的知识,希望对你有一定的参考价值。

// Import the required component classes.
import fl.controls.Label;

// Create a new instance of the Font1 symbol from the document's library.  
var myFont:Font = new MyFont();

// Create a new TextFormat object, and set the font and size properties.
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = myFont.fontName;
myTextFormat.size = 8;

/* Create a new Label component instance, set the textField.antiAliasType property,
   set the embedFonts and textFormat styles, and add the label to the display list. */
var myLabel:Label = new Label();
myLabel.text = "The quick brown fox jumped over the lazy dog";
myLabel.autoSize = TextFieldAutoSize.LEFT;
myLabel.move(10, 10);
myLabel.textField.antiAliasType = AntiAliasType.ADVANCED;
myLabel.setStyle("embedFonts", true);
myLabel.setStyle("textFormat", myTextFormat);
addChild(myLabel);

以上是关于ActionScript 3 As3:向Label组件添加字体(fl.controls.Label)的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3:使用新的Object()向TextField()添加文本样式

ActionScript 3 AS3:使用新的StyleSheet()对象向TextField()添加样式

ActionScript 3 AS3:使用新的TextFormat()向TextArea组件添加样式

如何在 ActionScript 中使用 MXML mx.controls.Label

[ActionScript 3.0] AS3.0和AS2.0的相互通信

ActionScript 3 AS3 SWFtrospection(as3swf)