|
-
How to load system fonts inside a comboBox in Flash AS3?
Hi,
I am building an application that needs system fonts to be loaded inside a comboBox.
I am not sure of the exact way of doing.
Following is the code that loads the system fonts in an array:
var systemFonts:Array = new Array();
var fontNames:Array =new Array();
systemFonts = Font.enumerateFonts(true);
systemFonts.sortOn("fontName");
for(var i:int = 0; i < systemFonts.length; i++)
{
fontNames.push(systemFonts[i].fontName);
}
I wanna know what to do after this so that I can load the fonts inside the comboBox.
Regards,
Avi
-
Got it working
var systemFonts:Array = new Array();
systemFonts = Font.enumerateFonts(true);
systemFonts.sortOn("fontName");
var font:TextFormat = new TextFormat();
var dp ataProvider = new DataProvider();
for (var i:int = 0; i < systemFonts.length; i++) {
dp.addItem({label:systemFonts[i].fontName, data:systemFonts[i]});
}
heading_selectfont.dataProvider = dp;
heading_selectfont.addEventListener(Event.CHANGE, change_font);
function change_font(event:Event):void
{
defaultHeadingFormat.font = heading_selectfont.selectedItem.label;
template.heading_txt.setTextFormat(defaultHeadingF ormat);
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|