1 Reply Latest reply on Oct 4, 2011 9:56 AM by Flex harUI

    Issue with embedding fonts

    rjoshicool Level 2

      I am having this code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                     xmlns:s="library://ns.adobe.com/flex/spark" 
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                     creationComplete="init(event)">
          
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          
          <fx:Script>
              <![CDATA[
                  import mx.core.UIComponent;
                  import mx.events.FlexEvent;
                  
                  private var userBio:TextField=new TextField();
                  
                  [Embed(source="assets/fonts/ARIAL.TTF", fontName="Arial", mimeType="application/x-font")]
                  private var ArialRegular:Class;
                  
                  private function init(e:FlexEvent):void
                  {
                      userBio.width = 200;
                      userBio.height = 300;
                      userBio.text = "Fortunately, there is a framework called Starling that tames the 3D beast and gives you the performance benefits of 3D, while helping you build 2D games and apps. The best part is that it is built in a way that is familiar. Rather than drawing triangles, fiddling with buffers, and using the AGAL mini assembler, you get to work with MovieClips, Sprites, and TextFields that, on the surface, feel just like the ones you are already used to."
                      userBio.multiline = true;
                      userBio.embedFonts = true;
                      userBio.wordWrap = true;
                      var tf:TextFormat = new TextFormat();
                      tf.font = "Arial";
                      tf.color = 0xAA5500;
                      userBio.setTextFormat(tf);
                      holder.addChild(userBio);
                  }
                  
              ]]>
          </fx:Script>
          
          <s:Group>
              <mx:UIComponent id="holder" width="200" height="300" />
          </s:Group>
          
      </s:Application>
      

       

      But the font is not reflected when I run the application. What might be wrong?