Wednesday, March 11, 2009

Embedding Fonts in Flash

I'm working on a project that displays articles from an external XML file. I want the text to be displayed as HTML, so I'm applying an external cascading style sheet (CSS) to the text field. In the Flash .fla file, I added a new font and linked it for ActionScript. Everything seemed to be working fine, and normal text was appearing like I imaged it would with the appropriate styles.

The problem was, I couldn't seem to get bold <b> or italic <i> tags to render the text properly.

After some digging, I found that I needed to add another new font for bold, one more for italic, and yet another for bold-italic text!

To add a new font, open the Options menu in the Flash file's Library, then select New Font... Select a font from the dropdown menu, and give it a name, which you will use like a new Font class. Be sure to update the linkage for your new font so you can apply it in AS3. If you need a bold, add another new Font, but check the Bold checkbox. Likewise with italic. Then when you apply a style sheet, you'll get the text displayed the way you want!


Aloha, Joe

1 comment:

  1. Thanks for sharing your experience.You saved my time.

    ReplyDelete