Home » ActionScript 3.0, Flash CS5

as3 ComboBox Font embedding problem Flash CS5

4 June 2011 2 Comments
Share on Facebook

Font embedding in combobox component problem hit me this morning when I tried to debug my old project. I Googled and found solution for font embed problem in combobox -actionscript code.

For the projects that need to change the font style of combobox component in flash to merge with the design well.

Here I am not going to explain the as3-flash font embedding

Follow the steps to embed font in flash combobox component:

1. Open Component panel, Window ->Components or CNTL+f7

2. Drag a ComboBox Component on Stage and name it as myComboBox

3. Follow this link to know how to create as3 font embedding in flash.

 

4. Remember the FontName, paste the code below in first frame.

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);

5. With the source file, I have added code to apply dataProvider to comboBox as3

Conclusion: In this article we have seen how to use combo box in flash actionscript and solution of how to embed font in flash using actionscript 3 (as3).

as3 combobox download source

GET THE UPDATES VIA EMAIL

We don't share your email anywhere, grab our rss via feedburner


  • Maitaicupcakes

    for those of you using an uncommon font like frutiger, anti aliasing defaults for animation. if you’re having problems with it looking horrible at 12 points and want to figure out how to advanced anti alias it you can add this to it:nnmyComboBox.textField.textField.antiAliasType = AntiAliasType.ADVANCED;nnthe 2 textFields were actually on purpose. weird huh? (the first one targets the combobox textinput – another flash component – textinput components have textField inside them… very confusing. but yeah, textFields have antiAliasType property so you can access it like that!

  • Anonymous

    Thanks for pointing out :)