AS3 Question for Flex Builder Users

Ok I know this is totally off-topic, but this is the only forum I frequent and I know there are some other Flex Builder users who may have run into this on here.

Does anyone know a way to get decent looking fonts in Flex Builder 2? I have tried every solution I could find for the last 7 hours or so... Even tried exporting a bitmap font in a SWF from Flash CS3. I did actually get fonts embedding at one point, but they still turned out all blurry, and now I can't even figure out what I did to get that to work. This is really killing my schedule, and I think I might have to resort to doing the text as jpgs in Photoshop 😠 I really can't believe there isn't a way to get it to work in Flex 2 though, so maybe someone has the magic formula?

EDIT: Still not working, but I remembered how I got it to embed. Setting embedFonts=true and antiAliasType.NORMAL will allow my fonts to embed, but they are blurry! If I set ADVANCED and embedFonts=true they don't show up at all, and if I use ADVANCED and turn embedFonts off, it just uses some default font. Also as a clarification I am placing the text at whole pixel values. I am also setting flashType='true' in the [Embed] tag just for clarification of the problem.
This works for me:
Code:
import flash.display.Sprite;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFormat;

public class Main extends Sprite {
   
   [Embed (source = "berlin.TTF", fontFamily = "berlin")]
   var asset : Class;
   
   public function Main () {
      
      var f : TextField = new TextField ();
      f.text = 'lo noob';
      
      var font = new TextFormat ("berlin", 20);
      f.embedFonts = true;
      f.setTextFormat (font);
      
      f.antiAliasType = AntiAliasType.ADVANCED;
      
      addChild (f);
      
   }
   
}


It was a horrible venture through stupid Flex classes.
Yeah basically that's what I've got, except a different font obviously and a few things like multline and wordwrap set to true. I can get ADVANCED to work with system fonts (not embedded), but when I embed I get nothing. They embed fine too if I turn it to NORMAL. I literally leave everything the same, even embedFonts=true, and just switch antiAliasType.ADVANCED to antiAliasType.NORMAL and they magically appear (but not looking too hot). I'm wondering what you're using (Flex Builder/Flex SDK), and also what exact version? Also do you have multiple SDKs installed and/or multiple versions of Flex Builder?

I completely wiped my installs and put the newest Flex Builder 2 on and I still get nothing. Of course, before that it suddenly stopped showing any text at all!!! I've basically given up at this point and am sticking to Verdana because at least it isn't blurry. I've literally spent over 12 hours on this in total pulling my hair out.
The SDK 2.01 build 159086 on Flashdevelop with FCSH.

Try compiling the script I posted?
Ok so the script you posted does work, but unfortunately not for my purposes! Why? Because I've discovered the root of my problem... I am making my game drawing everything to one bitmap on the screen using copyPixels for speed. It's blazing fast too, but the problem is that apparently TextFields with advanced anti-aliasing refuse to render when using copyPixels!!! Doh!!! I have tried your exact script and added a bitmap below the textfield and did a draw into it of the textfield. It comes up blank, while the textfield is still there. I switch to AntiAliasType.NORMAL and BAM, they both show up. This leads me to believe that this is most definitely a bug with Flex. Apparently one of many concering text...

I might have to consider using actual TextFields on the screen above the bitmap, which probably won't affect performance a whole lot, but you never know. Most of the text is on menus and stuff, so that won't be a problem. So it will be a pain, because I have to replace my handy DrawText functions with a mess of ugly code to create TextFields and then get rid of them, but I think it will actually work! So thanks for your help Gust! Here's the code with the draw to Bitmap test BTW. It would be great if you could confirm that it works the same way on your setup. Then I would feel confident submitting a bug report to the Flex Bug Database.

Code:
package {
   import flash.display.Sprite;
   import flash.text.AntiAliasType;
   import flash.text.TextField;
   import flash.text.TextFormat;
   import flash.text.*;
   import flash.display.Bitmap;
   import flash.display.BitmapData;

   public class TestFonts extends Sprite {
      
      //embed a font that exists on your system
      [Embed (source = "C:/WINDOWS/Fonts/CENSCBK.TTF", fontName = "_yourfont")]
      private var asset : Class;
      
      public function TestFonts () {
        
         var bdata:BitmapData = new BitmapData(400,300,true,0x00000000);
         var bitmap:Bitmap = new Bitmap(bdata,"never",false);
         bitmap.x = 0;
         bitmap.y = 70;
        
         var f : TextField = new TextField ();
         f.text = 'This is a test';
         f.autoSize = TextFieldAutoSize.LEFT;
        
         var font:TextFormat = new TextFormat ("_yourfont", 22);
         f.embedFonts = true;
         f.setTextFormat (font);
        
         f.antiAliasType = AntiAliasType.ADVANCED;         //change this to normal to see it work
         f.sharpness = 100;
         f.gridFitType = GridFitType.PIXEL;
        
         bdata.draw(f,null,null,null,null,false);
         addChild (f);
         addChild(bitmap);        
      }
      
   }

}

It seems to not have the problem if you put the textfield in a Sprite and draw that. :D!
That is so awesome! I'll have to try that, it would be a much easier workaround than what I had planned. I owe you one 😀

Original thread: https://box2d.org/forum/viewtopic.php?t=478