|
How to Embed Multiple Fonts in Dynamic Text Fields in Flash |
|
As of Flash 8, embedding multiple fonts for use in an HTML text field is still not as easy as it should be. The documentation makes it too complicated, and I found some people doing it with CSS styles and with the TextFormat object , but I believe I've found a better way.
- Create your dynamic text field and check the "show as HTML" button.
- Insert some dummy text and apply formatting of every sort you
intend to use, i.e. highlight different words, applying bold, italic,
new fonts as necessary.
- On the Embed menu, tell it to embed whatever characters you
desire. When Flash exports the text box, it will include the fonts that
you used in your dummy text.
That's it, if you don't need a lot of Actionscript control. If you DO need more control, follow these instructions:
- In the contextual menu for your Library palette, select "New Font".
Give it a unique name without spaces and select the font to embed. Hit
OK.
- Right click the font in the Library and click "Linkage". Check
"Export for Actionscript". Your unique name should now appear in the
identifier field. Repeat steps 1 and 2 for all your desired fonts.
- Place an instance of a text field on your stage and give it an
instance name. Make sure the HTML box is checked. Then you need to
write some ActionScript on a keyframe like so:
theTextField.embedFonts=true; theTextField.htmlText="";
- Type some sample text in the text field. You need to have some
sample text from every font you intend to use. Do this by highlighting
the text and selecting YOUR EMBEDDED FONT from the font list. YOU WILL
KNOW IT IS YOUR EMBEDDED FONT BY THE ASTERISK(*) AT THE END OF THE NAME.
- Now your fonts are available in the text field. The HTML you insert into it can be formatted like so:
<font
size='21' color='#cc092f' face='Eurostile'>Font in
Eurostile.</font><font size='21' color='#cc092f'
face='Birch'>Font in Birch.</font>
Note that the
asterisk is not required in the HTML. Remember that if you want to use
special characters you need to use numerical HTML entities (e.g.:
&123;) rather than the keyword-based kind (e.g.: &emdash).
|