2 Replies Latest reply on Apr 13, 2010 9:24 AM by bandsitebuilder

    StyleManager issue with multiple runtime embedded fonts


      I am porting an application from Flex 3 to 4 and I am having an issue embedding multiple fonts in a TextArea using StyleManager.


      I was able to successfully embed multiple fonts directly in the css/mxml (as outlined in this post http://forums.adobe.com/thread/604156 ) however, when I extract the css for each font and compile it into its own swf, it will only render the font specifically designated by the fontFamily attribute.


      Why would the fonts render perfectly when embedded in the main mxml doc, but not when loaded in via StyleManager?


      my code:


                 private function onComplete() : void


                      _request =  getStyleManager().loadStyleDeclarations2('Flood.swf',false);

                      _request.addEventListener(StyleEvent.COMPLETE,  onFont1Load, false, 0, true);



                  private function onFont1Load(event:StyleEvent) : void


                       trace( 'Fruitger is loaded');

                      _request2 =  getStyleManager().loadStyleDeclarations2('Daisy.swf',false);

                      _request2.addEventListener(StyleEvent.COMPLETE,  onFont2Load, false, 0, true);



                  private function onFont2Load(event:StyleEvent) : void


                      trace( 'Daisy is loaded');




                   private function onFontLoad():void


                      myTextArea.setStyle("fontFamily", "Daisy");

                      var tf : String = '<P><FONT FACE="Flood"  SIZE="26" COLOR="#000000">This is a nice piece of text in  Flood</FONT></P>' +

                          '<P><FONT FACE="Daisy" SIZE="23"  COLOR="#FF0000">This is a nice piece of text in  Daisy</FONT></P>';

                      myTextArea.textFlow = TextConverter.importToFlow(tf,  TextConverter.TEXT_FIELD_HTML_FORMAT);



                  public static function getStyleManager():IStyleManager2


                      return  mx.styles.StyleManager.getStyleManager(SystemManagerGlobals.topLevelSystemManagers[0]);





      Thanks in advance!