Using library embedded fonts in Actionscript 3.0 / 2.0
This is a small tutorial on how to use embedded fonts in the library with Actionscript 3.0 / 2.0.
You have to follow the next 4 steps to correctly embed and use library fonts in your code.
1. Add the font to the library - right click the library panel and select 'New Font'. From the 'Font' drop down select the font you want to embed and give it a name in the 'Name' field. The name can be the same with the font.
2. Right click on the newly added font in the library, select 'Linkage' and check the 'Export for ActionScript' check box. Click 'Ok' to aplly the new settings.
3. Select the text field that you want to use the embedded font for and choose the correct font from the font list in the property panel. You will be able to distinguish the library embedded fonts because of the asterisk mark (*) that will appear next to the name on the right.
4. In your actionscript code, you will need to set the embedFonts property of the text field to 'true'. Example:
mytxt.embedFonts=true;
(assuming that mytxt is the name of the text field that you assigned in the properties panel)
For using embedFonts with controls you need to follow the first 3 steps and then apply the embedFonts property in the following manner:
mycontrol.setStyle("embedFonts", true);
Comments
1 comment postedcant you please tell me how to do it when you create a textField with actionscript 3 (tFmt.font = "myFont"...). Tks a lot
Post new comment