Embed Fonts with AS3… May 3, 2007 at 12:47 pm
…the Flash CS3 kind of way! It´s simple, i can tell you - after trying for days…
Step1:
Add the font you want to the library. Be sure to name the font and give it a class linkageID-name too.
Step2:
var yourFont = getDefinitionByName( “yourFontLinkageID-name” );
Font.registerFont(yourFavFont);
Step3:
Finally just refer to the font-name when formatting your textfield.
import flash.text.*;
var format:TextFormat= new TextFormat();
format.font= “standard 07_53″;
format.color= 0×000000;
format.size= 20;
var display_txt:TextField = new TextField();
display_txt.embedFonts = true;
display_txt.autoSize= TextFieldAutoSize.LEFT;
display_txt.text = “Hello World!”;
display_txt.setTextFormat(format);
addChild(display_txt);
Got it.


Leave a Reply