If you want to display both the fontName and fontStyle, define a labelFunction 
for the combobox.

function setLabel(item:Object):String {
var fnt:Font = item as Font;
return fnt.fontName + " (" + fnt.fontStyle + ")";
}

font_cb.labelFunction = setLabel;


----- Original Message ----- From: "Creighton, Gerry" <gcreigh...@discmakers.com>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Monday, January 24, 2011 4:11 PM
Subject: [Flashcoders] ComboBox label issue


I�m having a problem properly displaying the font name and variant in a 
combobox.
I have fonts embedded in my swf and am exporting for AS.
I have a ComboBox that I�m populating from an enumerated font array like so...
<code>

fontArray = Font.enumerateFonts(false);//using false only enumerates embedded 
fonts
fontArray.sortOn("fontName",Array.CASEINSENSITIVE);
_fontDP = new DataProvider(fontArray);

FontCB.dataProvider = _fontDP;

//when I set up the FontCB I set the labelField like so...
FontCB.labelField = "fontName";
</code>

When the ComboBox is opened the display names for the fonts only show the main 
name of the font and not
each variant (shown below). When I publish and select to �Generate Size Report� I 
get all of the proper font names & variants.
How can I get the proper font names to display properly.
Ie
Arial
Arial
Arial
Arial
Book Antiqua
Book Antiqua
Book Antiqua
Book Antiqua
Helvetica
Helvetica
Helvetica
Helvetica

_______________________________________________

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to