Font Styles in AS2 on Flash CS5

While working on updating a legacy project developed in Flash Professional using Action Script 2 I ran into some issues with HTML text and formatting. Certain portions of the HTML text (which was being loaded from an XML file) where supposed to be displayed as either bold or italics (or both), but instead the text within the <i> or <b> tags was not displaying at all.

I tried a whole bunch of stuff to get it working. Ultimately what we found was that for some reason Adobe seems to have changed the way fonts are embedded when you publish a flash project. So while we were embedding Arial (probably not necessary given our audience) it was only embedding one style of the font (ie. regular, bold, italic). So when we switched the embedded font from ‘regular’ to ‘italic’ the reverse issue was occurring, all of the text within the <i> tags was showing up while everything disappeared.

The solution was to change the font for the one we were embedding to the ‘device’ font ‘sans serif’ this allowed flash to decide which style to use on the fly. I am sure this is not an issue in AS3, unfortunately re-writing the code was not an option in the time-frame I had.

Note: We tried embedding all of the styles we needed for the font but Flash still seems incapable of applying the correct style when appropriate.

Thanks goes to John for helping me resolve this issue.