2 Replies Latest reply on Aug 25, 2011 4:04 PM by Budkin76

    Using a font embedded swf in mxml




      We need to load in fonts at runtime due to localization needs. I've got this working in an AS3 project in Flex by embedding the font in a class and then loading that swf into another class and registering the font.




      What I need now is to be able to use that font class in MXML components like a spark label. I can't seem to get it to work though. I've tried referencing the swf in a style sheet, then making a style class in the CSS using that font like this:


      /* Embed.css */


      @font-face {

           src: url("_Arial.swf");

           fontFamily: "_Arial";





      font-family: "_Arial";

      fontSize: 40;

      color: #000000;



      Then in the MXML I have this:


      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"


                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">



           <fx:Style source="Embed.css"/>


           <s:Label text="This should display my embedded text." width="100%" styleName="genericTextArial"/>




      However I can't seem to get it to render. I've also tried the method of embedding the font in a text field in Flash Professional and loading in that swf and it doesn't work either. Am I missing a parameter or just going about this the wrong way?