Font Short Cutty


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



Copy this code and paste it in your HTML
  1. package {
  2.  
  3. import flash.util.describeType;
  4. import flash.display.MovieClip;
  5. import flash.display.TextField;
  6. import flash.text.TextFormat;
  7. import flash.text.AntiAliasType;
  8.  
  9. public class Test extends MovieClip {
  10.  
  11. // be sure this is pointing to a ttf font in your hardrive
  12. [Embed(source="C:\WINDOWS\Fonts\somefont.ttf", fontFamily="foo")]
  13. public var bar:String;
  14.  
  15. public function Test() {
  16.  
  17. var format:TextFormat = new TextFormat();
  18. format.font = "foo";
  19. format.color = 0xFFFFFF;
  20. format.size = 130;
  21.  
  22. var label:TextField = new TextField();
  23. label.embedFonts = true;
  24. label.autoSize = TextFieldAutoSize.LEFT;
  25. label.antiAliasType = AntiAliasType.ADVANCED;
  26. label.defaultTextFormat = format;
  27. label.text = "Hello World!";
  28. addChild(label);
  29. }
  30. }
  31. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.