I've blogged before about embedding fonts in Flex applications by first creating an embedded font in a Flash movie. The process is pretty simple and works well with one large caveat, your final SWF is larger based on the file size of any embedded fonts. Why is this bad? If you've embedded four of your favorite fonts and your app is one big Flash movie or Flex application your overall app size is increased to include the font resources.

Wouldn't it be better if you could load the fonts at runtime only when they're needed? Well, you can! Lee Brimelow recorded a fifteen minute tutorial showing you how to use Flash CS4 and Flex SDK metadata to create runtime loaded fonts. He walks through the entire process including selecting a font, writing the ActionScript 3 code to embed a font, restricting the font to certain glyphs, and then embedding the external font movie into a new, separate movie at runtime.

As Lee points out towards the end of the tutorial, using runtime loaded fonts should be considered a best practice if you're using Flash CS4. You can do what we've always been able to do and embed a font directly in the Flash CS4 library, but why tax your entire application this way and why include all the glyphs if you don't need them?

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on March 16, 2009 at 8:00 AM. It was filed in the following categories: Flex, Flash. It has been viewed 13497 times and has 1 comments.

1 related blog entries

1 Responses to Lee Brimelow on Creating Runtime Loaded Fonts in Flash CS4

  1. Hi Aaron,

    You can also check the pixFont editor.

    This is a great AIR application that simplifies the creation of external fonts:

    We used it as part of the best practises for the OnDemand Business RIA application: