Skip navigation
Currently Being Moderated

Embedded font and Combobox

Mar 22, 2011 11:08 PM

Hello All,


Scenario of my application: Application have combobox filled with fonts list. When user select font from combobox. Application load font swf from server and apply to text.


I have embedded fonts in SWF using css.

@font-face {   

    src: url("assets/fonts/arial.ttf");   
    fontFamily: "Arial";   
    fontWeight: "normal";   
    embedAsCFF: true;   


here is code snippet to load font from server.


var eventDesi:IEventDispatcher = styleManager.loadStyleDeclarations2(fontStyleName.@swfURL);
            eventDesi.addEventListener(StyleEvent.ERROR,function(event:StyleEvent ):void{
      "error while downloading font " + fontStyleName.@name);
            eventDesi.addEventListener(StyleEvent.COMPLETE,function(event:StyleEv ent):void{
                fontStyleName.@isDownloaded == "true";
               if(functionToCall != null)



When I select font arial form combobox all list of fonts,tool tips are get disappear. My primary exploration is combobox has arial font and I am loading again arial and registering it. This may be the cause.


Is there any way to set embeded font to any control?




  • Currently Being Moderated
    Mar 23, 2011 12:05 AM   in reply to Vikram_S

    I think ComboBox uses bold text so you have to embed a bold font as well.

    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 1:39 AM   in reply to Vikram_S

    Follow this tutorial and use the code below..
    var arial:Font = new ArialFont();
    var myFormatBlack:TextFormat = new TextFormat();
    myFormatBlack.font = arial.fontName;
    myFormatBlack.size = 18;
    myFormatBlack.color = 0x000000;
    myComboBox.textField.setStyle("embedFonts", true);
    myComboBox.textField.setStyle("textFormat", myFormatBlack);
    myComboBox.dropdown.setRendererStyle("embedFonts", true);
    myComboBox.dropdown.setRendererStyle("textFormat", myFormatBlack);
    myComboBox.setStyle("embedFonts", true);
    myComboBox.setStyle("textFormat", myFormatBlack);
    myComboBox.prompt = "Select State";
    myComboBox.width = 248;
    myComboBox.height = 25;
    myComboBox.x = 100
    myComboBox.y = 100
    myComboBox.setStyle("textPadding", 1);

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points