3 Replies Latest reply on Jun 10, 2008 1:15 PM by mxbarnum

    Embedded assets and sharing

      Embedded assets and sharing

      I am rather new to flex and need a little guidance. I have been playing around with embedding a font in a component package (.swc). I am trying to find a way to embed a font that all components in the package can share. The following works but I don’t know if it is the best way:

      Embedding the font in a shared class…

      package ILVisualComponents{

      public class ILShared{
      private var _EmbededFont:Class;


      Setting a textarea's descendant to the font in the swf…

      package ILVisualComponents{
      import ILVisual.ILShared;
      import mx.controls.TextArea;

      public class ILTextArea extends TextArea

      public function ILTextArea()
      this.setStyle("fontFamily","AmericanTypewriter Medium");//<--font from swf in shared class


        • 1. Re: Embedded assets and sharing
          Gaurav J Adobe Employee
          You can embed fonts using CSS file and then define at the application level. something like:

          Application {
          font-family: "AmericanTypewriter Medium";

          @font-face {
          src: url("ILMainFont.swf");
          fontFamily: "AmericanTypewriter Medium";

          Gaurav Jain
          Flex SDK Team
          • 2. Re: Embedded assets and sharing
            SonOfGerale Level 1
            Thanks for the reply, Gaurav J.
            The example you gave works well in the main mxml of an application. I tried to duplicate it in my library application but the compiler complained about invalid formats. I think this was because I was trying to set application specific settings in my swc. package. If an application has specific styles set I do not wish individual components to interfere.

            Is there a way I can define a css in the scope of a package namespace or something similar?
            • 3. Re: Embedded assets and sharing
              Was this resolved? I too am struggling with this topic - I have a OTF font embedded in an SWC and Style sheet in an SWC, but I cannot seem to use them from an SWF that references the SWC.