Posted By

Ether on 02/03/10


Tagged

actionscript as3 fonts embedding


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

dubogii
jondiscipulo


Embedding fonts in ActionScript 3


 / Published in: ActionScript 3
 

URL: http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/

  1. // Create a new instance of the Font1 symbol from the document's library.
  2. var myFont:Font = new Font1();
  3.  
  4. /* Create a new TextFormat object, and set the font property to the myFont
  5.   object's fontName property. */
  6. var myFormat:TextFormat = new TextFormat();
  7. myFormat.font = myFont.fontName;
  8. myFormat.size = 24;
  9.  
  10. /* Create a new TextField object, assign the text format using the
  11.   defaultTextFormat property, and set the embedFonts property to true. */
  12. var myTextField:TextField = new TextField();
  13. myTextField.autoSize = TextFieldAutoSize.LEFT;
  14. myTextField.defaultTextFormat = myFormat;
  15. myTextField.embedFonts = true;
  16. myTextField.text = "The quick brown fox jumped over the lazy dog.";
  17. addChild(myTextField);

Report this snippet  

You need to login to post a comment.