I've never figured out why Flash has such trouble embedding fonts in components but I can't for the life of me figure out how to with the new tlf textfields. I have my tlf text field working fine and I want to use the same format for my combo box. It works fine on the field but why not for the combo box?
// set format
var myFormatBlack:TextLayoutFormat = new TextLayoutFormat();
myFormatBlack.color = 0x990000;
myFormatBlack.fontFamily = "Doctor Soos Bold";
myFormatBlack.fontSize = 24;
type_cb.textField.setStyle("embedFonts", true);
type_cb.textField.setStyle("textFormat", myFormatBlack);
// add status text box
var status_txt = new TLFTextField();
content_layer.addChild(status_txt);
status_txt.x = 50;
status_txt.y = 500;
status_txt.width = 900
status_txt.height = 24;
status_txt.multiline = false;
status_txt.selectable = false;
status_txt.border = true;
status_txt.text = "Testing!";
// add text flow to text box
var status_flow = status_txt.textFlow;
status_flow.hostFormat = myFormatBlack;
status_flow.flowComposer.updateAllControllers();
To embed fonts in CheckBox component, ComboBox component, and a Slider component, requires that a font symbol with the linkage class name of Font1 (or whatever) exists in the library.
http://www.adobe.com/devnet/flash/quickstart/embedding_fonts.html
Unfortunately that does NOT work. Even when you paste the exact code into a class it does not work. I dug into some old projects and found this code that works perfectly. I just created a custom class and imported it from my doc class so every combo box in the project followed the same style:
upFormat = new TextFormat();
upFormat.font = new DoctorSoos().fontName;
upFormat.color = 0x666666;
upFormat.size = 16;
upFormat.letterSpacing = .5;
StyleManager.setStyle("upFormat",upFormat);
overFormat = new TextFormat();
overFormat.font = new DoctorSoos().fontName;
overFormat.color = 0x666666;
overFormat.size = 16;
overFormat.letterSpacing = .5;
StyleManager.setStyle("overFormat",overFormat);
StyleManager.setComponentStyle(ComboBox,"textFormat",StyleManager.get Style("upFormat"));
StyleManager.setComponentStyle(TextInput,"textFormat",StyleManager.ge tStyle("upFormat"));
StyleManager.setComponentStyle(CellRenderer,"textFormat",StyleManager .getStyle("overFormat"));
North America
Europe, Middle East and Africa
Asia Pacific