Saturday, December 29, 2007

Embedding fonts in flash

Does your dynamic text look really bad when tested? Then I recommend you embed the font you plan on using.

Open the Library panel (Ctrl+L).

Add a font to your library - click the options menu in the upper right corner of the panel and select New Font.

In the Font Symbol Properties dialog box select the font, size and style that you want. Click OK to close the dialog box.

Right click the font symbol in the library and select Linkage.

In the Linkage Properties dialog box, click the Export for ActionScript button. ok.

Select the text tool from the Tools panel and draw a dynamic text field on the Stage.

Give the text field an instance name of "txt". In the Font menu select the symbol name you gave the embedded font earlier. You should see an asterisk (*) beside the name of font.

In the Property inspector set the font size and style to match those in the Font Symbol Properties dialog box earlier.

add the following code to Frame 1 of your Flash document:

txt.embedFonts = true;

add text into the dynamic text field and test the SWF. You should see your text and it should look much better!

***Remember, If you have more than one text block, you are going to have to add another line of code like you did with "txt.embedFonts = true; " So name your new text block instance "txt2" then add this actionscript: txt2.embedFonts = true;***

No comments: