When you need to use a custom font for dynamic text fields, you will need to embed the font so that it can be displayed on all machines. Firstly, in the library select the menu and from the drop down menu and choose ‘New Font’. The following window should appear. This is where you select the font family, font styles and the character ranges of the fonts. You can optionally also include specific characters instead of the entire character range.
If you want to create text fields with custom fonts via code you will need to select the ‘Export to Actionscript’ check box from the Actionscript tab. Then give a unique class name and click ok. All you need to do now is to create a new instance of the TextField and TextFormat Class. Here is an example:
//Create a new instance of the custom font var font:Font1 = new Font1(); //Create a new instance of the Textformat class with the font property //set to the name of the custom font, size of the text and the colour //of the text. var format:TextFormat = new TextFormat(); format.font = font.fontName; format.size = 14; format.color = 0x000000; //Create a new instance of the TextField class with the //embedFonts property set to true and the defaultTextFormat //property set to the TextFormat created above. var tf:TextField = new TextField(); tf.embedFonts = true; tf.defaultTextFormat = format; tf.text = 'This is a text field'; addChild(tf);