开发者

Flash CS4 embedded font style issue

I'm using some fonts embedded in SWF in a program I'm developing. I need to use some specific font style like '37 Thin Condensed' and '26 Ultra Light Italic' etc... how can I开发者_如何转开发 specify these style when using fonts? I want to set style using AS3 code...


An example for Helvetica Neue 37 Thin Condensed

In your Library panel, in the top right corner, click for the drop down and choose "New Font."

For the name field, put "HelveticaNeue37ThinCondensed", for the the font field, choose "Helvetica Neue," for the style field choose "37 Thin Condensed." If you see a button on the bottom right labeled "Advanced" click it.

Under "Linkage" check "Export of ActionScript," and make the class field match the name field from above: "HelveticaNeue37ThinCondensed."

Click OK.

Now you can apply the font in ActionScript:

var font1:Font = new HelveticaNeue37ThinCondensed();

var tfoBodyText:TextFormat = new TextFormat();
tfoBodyText.font = font1.fontName;

var tfiBodyText:TextField = new TextField();
tfiBodyText.embedFonts = true;
tfiBodyText.defaultTextFormat = tfoBodyText;
tfiBodyText.text = "This is some text for the new text field.";

addChild(tfiBodyText);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜