Embedding fonts in AS3 on Flex 3


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

This describes how to embed font in to Flex(mxml) file without using the tag (fully AS3).


Copy this code and paste it in your HTML
  1. [Embed(source='assets/CALIBRII.TTF', fontName='fontCalibri', fontStyle='italic', fontWeight='light', mimeType='application/x-font')]
  2.  
  3.  
  4. textFormat = new TextFormat();
  5. textFormat.color = 0xFFFFFF;
  6. textFormat.font = "fontCalibri";
  7. textFormat.size = 11;
  8.  
  9. textField = new TextField();
  10. textField.embedFonts = true;
  11. textField.text = "Embeded Text";
  12. textField.selectable = false;
  13. textField.background = true;
  14. textField.multiline = false;
  15. textField.backgroundColor = 0x000000;
  16. textField.setTextFormat(this.textFormat);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.