Using text fields in ActionScript 2 and font embedding
This is how I like to create text fields with AS2, avoiding using the Stage to add dynamic text fields:
var txt:TextField = createTextField("txt", 0, 0, 0, 0, 0);
txt.autoSize = true;
txt.multiline = true;
txt.selectable = false;
txt.wordWrap = false;
txt.embedFonts = true;
txt.html = true;
txt.htmlText = "This is my text";
txtFormat = new TextFormat();
txtFormat.font = "my_font";
txtFormat.size = 13;
txt.setTextFormat(txtFormat);
One more thing is needed to be done, define my_font in the Library, by selecting New Font in the context menu after clicking the icon in the upper right corner of the Library. You must select "Export for ActionScript" and "Export in first frame", and the Identifier should be named my_font.
Bare in mind that the actual font is not saved in the FLA file, it is actually a reference to the font on your hard-drive. When you're sharing the FLA with someone you must remember to put the font file next to it, and the person using your FLA file should install first the font in his/her OS.
A comprehensive approach on this nightmare issue these fonts in Flash prove to be can be found here: http://www.connectedpixel.com/blog/fonts/embedding









Nice tip. I always have issues with embedding fonts in flash.
you must set autosize after specifying text..