AS3 Embed a font in with the flex SDK


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

Thanks to Thomas John.


Copy this code and paste it in your HTML
  1. import flash.text.TextField;
  2. import flash.text.TextFormat;
  3.  
  4. [Embed(source="your_font_file_name", fontName="font_name_temp", mimeType="application/x-font")]
  5. public static const FONT_NAME_TEMP_FONT:Class;
  6.  
  7. // create a new TextField
  8. var tf_tmp:TextField = new TextField();
  9.  
  10. // don't forget this one
  11. tf_tmp.embedFonts = true;
  12.  
  13. // and finally, just use the font name you specified earlier
  14. tf_tmp.defaultTextFormat = new TextFormat("font_name_temp", 8, 0xFFFFFF);

URL: http://blog.open-design.be/2008/05/27/embed-a-font-in-as3-with-the-flex-sdk/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.