Mega Code Archive

 
Categories / Flash ActionScript / Development
 

Set the font with CSS

package{   import flash.display.Sprite;   import flash.text.*;   public class Main extends Sprite{     public function Main(){         var styleSheet:StyleSheet = new StyleSheet(  );         var pStyle:Object = new Object(  );         pStyle.fontFamily = "fontName";         styleSheet.setStyle("p", pStyle);         var t:TextField = new TextField(  );         t.embedFonts = true;         t.styleSheet = styleSheet; // Assign styleSheet before assigning htmlText!         t.htmlText = "<p>hello world</p>";     }   } }