嵌入Flash Builder中的文本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了嵌入Flash Builder中的文本相关的知识,希望对你有一定的参考价值。

embeded multiple fonts
  1. package
  2. {
  3.  
  4. import flash.text.Font;
  5.  
  6. public class MyFonts
  7. {
  8.  
  9. [Embed(source = '../fonts/visitor2.ttf', fontName = 'visitor2', embedAsCFF = 'false')]
  10. private var visitor2:Class;
  11.  
  12. [Embed(source = '../fonts/bitlow.ttf', fontName = 'bitlow', embedAsCFF = 'false')]
  13. private var bitlow:Class;
  14.  
  15. [Embed(source = '../fonts/Sansation_Regular.ttf', fontName = 'Sansation_Regular', embedAsCFF = 'false')]
  16. private var Sansation_Regular:Class;
  17.  
  18. [Embed(source = '../fonts/LiberationSerif_Regular.ttf', fontName = 'LiberationSerif_Regular', embedAsCFF = 'false')]
  19. private var LiberationSerif_Regular:Class;
  20.  
  21. [Embed(source = '../fonts/f04b_08.ttf', fontName = 'f04b_08', embedAsCFF = 'false')]
  22. private var f04b_08:Class;
  23.  
  24. [Embed(source = '../fonts/calibri.ttf', fontName = 'calibri', embedAsCFF = 'false')]
  25. private var calibri:Class;
  26.  
  27. [Embed(source = '../fonts/baars.ttf', fontName = 'baars', embedAsCFF = 'false')]
  28. private var baars:Class;
  29.  
  30. [Embed(source = '../fonts/BabelSans.ttf', fontName = 'BabelSans', embedAsCFF = 'false')]
  31. private var BabelSans:Class;
  32.  
  33.  
  34.  
  35. private static const MyFonts:Array =
  36. [
  37. 'visitor2',
  38. 'bitlow',
  39. 'Sansation_Regular',
  40. 'LiberationSerif_Regular',
  41. 'f04b_08',
  42. 'calibri',
  43. 'baars',
  44. 'BabelSans'
  45. ];
  46.  
  47. public function MyFonts()
  48. {
  49. var length:int = MyFonts.length;
  50.  
  51. for (var i:int; i < length; i++)
  52. {
  53. Font.registerFont(this[MyFonts[i]]);
  54. }
  55. }
  56.  
  57. }
  58.  
  59. }
  60.  
  61.  
  62.  
  63. private var tfStatus:TextField;
  64.  
  65. private function showStatusMessage(message:String):void
  66. {
  67. if (!tfStatus)
  68. {
  69. tfStatus = new TextField();
  70. var format:TextFormat = new TextFormat();
  71. format.size = 10;
  72. format.align = TextFormatAlign.CENTER;
  73. format.font = "Sansation_Regular";
  74. tfStatus.embedFonts = true;
  75. //tfStatus.autoSize = TextFieldAutoSize.CENTER;
  76. tfStatus.defaultTextFormat = format;
  77. tfStatus.text = message;
  78. tfStatus.width = stage.stageWidth - 10;
  79. tfStatus.wordWrap = false;
  80. tfStatus.x = 5;
  81. tfStatus.y = 460;
  82. tfStatus.antiAliasType = AntiAliasType.ADVANCED;
  83. tfStatus.visible = true;
  84. addChild(tfStatus);
  85. }
  86. else
  87. {
  88. tfStatus.visible = true;
  89. tfStatus.text = message;
  90. }
  91. }

以上是关于嵌入Flash Builder中的文本的主要内容,如果未能解决你的问题,请参考以下文章

Flash Builder 4.5.1mobile 项目的嵌入元数据时间限制?

Flash Builder 中的 TODO 任务列表

在 ActionScript (Flash Builder) 中调试 JavaScript 注入

解决 Flash Builder 中的包名称冲突

Flash Builder 如何确定要包含哪些 sdk 库?

Flash Builder 4 中的编码 SWF 属性