Apply text embedding to external swf
I am using Flash Builder 4 to implement embedded text, what I would like to do is apply this embedded text to a text field in an external SWF (.fla file using Flash CS4).
My code is like so:
[Embed(source='//lib//fonts//Tahoma.ttf', fontName='_Tahoma', embedAsCFF="false")]
private var embedString:String; // added for embed font
var format:TextFormat = new 开发者_运维问答TextFormat();
format.font = "_Tahoma";
// WHEN THIS IS SET TO TRUE THE TEXT DISSAPEARS?
(path to .fla).textLabel_txt.embedFonts = true;
(path to .fla).textLabel_txt.defaultTextFormat = format;
(path to .fla).textLabel_txt.setTextFormat(format);
I have set the fontFamily of the dynamic text field inside the .fla to a custom font and have the AnitAlias set for readability. The Custom font is set to 'Tahoma'.
You need to embed font as a class:
[Embed(source='//lib//fonts//Tahoma.ttf', fontName='_Tahoma', embedAsCFF="false")]
public var EMBED_FONT:Class;
And then to register your embeded font :
Font.registerFont(EMBED_FONT);
精彩评论