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{
Alert.show("error while downloading font " + fontStyleName.@name);
})
eventDesi.addEventListener(StyleEvent.COMPLETE,function(event:StyleEv ent):void{
fontStyleName.@isDownloaded == "true";
if(functionToCall != null)
functionToCall.call();
})
Problem:
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?
Thanks,
Vikram
Hi,
Follow this tutorial and use the code below..
http://www.designscripting.com/2011/06/as3-combobox-font-embedding-problem-flash-cs5/
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);
North America
Europe, Middle East and Africa
Asia Pacific