Embedding Fonts for Anti Aliasing in Flash AS3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // To use this method you must embed and "Export for AS" the font in the Flash IDE (eg. Flash CS3, Flash CS4).
  2. // You Can do this by clicking the menu on the library panel, then go "New Font"
  3. // Then select "Export for Actionscript, and give your font class name.
  4. // The class name is the name that you will reference on the line directly below this.
  5.  
  6. var myFont = new MyFontClassName();
  7.  
  8. var myFormat:TextFormat = new TextFormat();
  9. myFormat.size = 40;
  10. myFormat.font = myFont.fontName;
  11.  
  12. var myText:TextField = new TextField();
  13. myText.defaultTextFormat = myFormat;
  14. myText.embedFonts = true;
  15. myText.antiAliasType = AntiAliasType.ADVANCED;
  16. myText.autoSize = "left";
  17. myText.text = "Here is some pretty that is anti-aliased!";
  18. addChild(myText);

URL: http://www.republicofcode.com/tutorials/flash/as3text/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.