Mega Code Archive

 
Categories / Flex / Graphics
 

Determine All Fonts Installed on a Users Computer

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">         <mx:VBox creationComplete="findAllFonts()">             <mx:Script>                                               private var style:StyleSheet;                              [Bindable]                     private var arr:Array;                              private function findAllFonts():void                     {                         arr = Font.enumerateFonts(true);                         arr.sortOn("fontName", Array.CASEINSENSITIVE);                     }                              private function setFont():void                     {                         text.setStyle("fontFamily", (cb.selectedItem as Font).fontName);                     }                                     </mx:Script>             <mx:ComboBox id="cb" dataProvider="{arr}" change="setFont()" labelField="fontName"/>             <mx:Text text="Sample Text" id="text" fontSize="16"/>         </mx:VBox> </mx:Application>