Flex 4中如何给Halo Label设置嵌入字体的例子

By Minidxer | October 11, 2009

接下来的例子演示了Flex 4中如何通过textFieldClass样式,给Halo Label设置嵌入字体。



下面是main.mxml:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application name="Label_textFieldClass_test"
  3.         xmlns:fx="http://ns.adobe.com/mxml/2009"
  4.         xmlns:s="library://ns.adobe.com/flex/spark"
  5.         xmlns:mx="library://ns.adobe.com/flex/halo">
  6.  
  7.     <fx:Style>
  8.         @namespace mx "library://ns.adobe.com/flex/halo";
  9.         @namespace s "library://ns.adobe.com/flex/spark";
  10.  
  11.         @font-face {
  12.             src: url("fonts/ArnoPro-Regular.otf");
  13.             fontFamily: ArnoEmbedded;
  14.             embedAsCFF: true;
  15.         }
  16.  
  17.         mx|Label, s|SimpleText {
  18.             fontFamily: ArnoEmbedded;
  19.             fontSize: 24;
  20.         }
  21.     </fx:Style>
  22.  
  23.     <fx:Declarations>
  24.         <fx:String id="txt">The quick brown fox jumps over the lazy dog.</fx:String>
  25.     </fx:Declarations>
  26.  
  27.     <s:VGroup horizontalCenter="0" verticalCenter="0">
  28.         <mx:Label id="lbl"
  29.                 text="{txt} [Label]"
  30.                 textFieldClass="mx.core.UITLFTextField"
  31.                 width="100%" />
  32.         <s:SimpleText id="simpleTxt"
  33.                 text="{txt} [SimpleText]"
  34.                 width="100%" />
  35.     </s:VGroup>
  36.  
  37. </s:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Gumbo, Label | No Comments » | Tags: ,

Search Posts