Posted By

leongaban on 09/12/10


Tagged

flash font TextField TextFormat


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

bobbym245
tspitzr


Simple TextFormat Manager AS3


 / Published in: ActionScript 3
 

http://leongaban.com/com/leongaban/Snipplr/Model/Fonts.as

  1. package com.leongaban.Snipplr.Model
  2. {
  3. import flash.text.Font;
  4. import flash.text.TextFormat;
  5. import flash.text.TextFormatAlign;
  6. import flash.text.TextFieldAutoSize;
  7. import flash.text.*;
  8.  
  9. public class Fonts
  10. {
  11. public static var data:Object = {};
  12. public static var customFormat1 = new TextFormat();
  13. public static var customFormat2 = new TextFormat();
  14.  
  15. customFormat1.font = "Arial";
  16. customFormat1.size = 14;
  17. customFormat1.bold = true;
  18. customFormat1.color = 0x000000;
  19. customFormat1.align = TextFormatAlign.LEFT;
  20.  
  21. customFormat2.font = "Arial";
  22. customFormat2.size = 11;
  23. customFormat2.bold = false;
  24. customFormat2.color = 0x000000;
  25. customFormat2.align = TextFormatAlign.LEFT;
  26. }
  27. }
  28.  
  29.  
  30. // How to use in other Classes:
  31.  
  32. /*videoTitle.defaultTextFormat = Fonts.customFormat1;
  33. videoTitle.border = false;
  34. videoTitle.embedFonts = false;
  35. videoTitle.selectable = false;
  36. videoTitle.mouseEnabled = false;
  37. videoTitle.x = 5;
  38. videoTitle.y = 8;
  39. videoTitle.width = titleSize;
  40. videoTitle.height = 30;
  41. videoTitle.text = titleString;
  42.  
  43. addChild(videoTitle);*/

Report this snippet  

You need to login to post a comment.