Return to Snippet

Revision: 10019
at December 3, 2008 12:09 by chrisaiv


Initial Code
// 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);

Initial URL
http://www.adobe.com/devnet/flash/quickstart/label_component_as3/#section7

Initial Description
I borrowed this example from the link above

Initial Title
As3: Adding a font to a Label component (fl.controls.Label)

Initial Tags


Initial Language
ActionScript 3