Clean Text In Flash


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

note to self - Basic settings for clean text in as3 flash project assuming fonts are embedded.


Copy this code and paste it in your HTML
  1. private function set_text(_txt:String, _size:Number, _font:String, _width:Number=250, txt_color:uint = 0x00CADF ):TextField{
  2.  
  3. var txt:TextField = new TextField();
  4. var fmt:TextFormat = new TextFormat();
  5.  
  6. fmt.font = _font;
  7. fmt.size = _size;
  8. fmt.leading = 1.5;
  9. fmt.kerning = true;
  10. fmt.color = txt_color;
  11.  
  12. txt.embedFonts = true;
  13. txt.defaultTextFormat = fmt;
  14. txt.multiline = true;
  15. txt.wordWrap = true;
  16. txt.antiAliasType ='advanced';
  17. txt.width = _width;
  18. txt.autoSize = 'left';
  19. txt.text = _txt;
  20.  
  21. return txt ;
  22.  
  23. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.