In Actionscript 2, it is possible to export fonts for Actionscript so that they can be used dynamically at a later date in code. Doing this is very useful, but it can be tricky to set up initially.
To embed a font, first create a new font by right clicking and selecting new font in the library.
Create a new font by selecting a family from the drop down menu, embed any required characters and give the font a name.
After the font has been created, we now need to click on the ‘Actionscript’ tab at the top and then the ‘Export for Actionscript’ checkbox.
Finally after this has been done hit the ok button and you should see the following in your library:
Now that our font is embedded in the library, we can use the font in our code. Here is an example:
var textFormat:TextFormat = new TextFormat(); textFormat.bold = true; textFormat.size = 16; //remember to set the name of the font to the name you set in the library linkage. textFormat.font = "Font 1"; //set textfield to the name of your textfield. textField.setTextFormat(textFormat); textField.embedFonts = true;