Set the font with CSS : StyleSheet : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » StyleSheet »

 

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>";
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» StyleSheet