Flex sdk 3.5.0 problem with ternary operators

I’ve got problems to isolate the problem into a very big project with many linked sources. After hours inspecting and commenting lines of code trying to figure out the reason why flex gave me an “internal error” I found the problem.
This very simple script was crashing the flex compiler if using the 3.5.0 sdk ( revision 3.5.0.12683 ).
Fortunately the 4.0.0 compiler works fine. At the end it seems to be the combination of “+” and “-” and the ternary operator.
package
{
   import flash.display.Sprite;
   public class ternary_test extends Sprite
   {
      public function ternary_test()
      {
         var n: Number = 0;
         var d: int = 3;
         var k: int = 5;
         var j: int = 10;
         n = 1 + ( -( d == 0 ? k : j ) );
         trace( "n=" + n );
      }
   }
}

will cause the compiler to crash with the following stack trace:

compile:

    [mxmlc] Loading configuration file /Applications/Adobe Flash Builder 4 Plug-in/sdks/3.5.0/frameworks/flex-config.xml

    [mxmlc] Error: null

    [mxmlc] java.lang.NullPointerException

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1290)

    [mxmlc] 	at macromedia.asc.parser.UnaryExpressionNode.evaluate(UnaryExpressionNode.java:51)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2153)

    [mxmlc] 	at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1497)

    [mxmlc] 	at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:56)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2124)

    [mxmlc] 	at macromedia.asc.parser.ArgumentListNode.evaluate(ArgumentListNode.java:45)...

FontReader, convert TrueType fonts in graphics with Flex

In the last period I was trying to find a way to convert a TrueType font character into graphics for a new Flex project.
First I found a way using TTX which can convert a font file into an XML with all the Glyph informations needed to recreate the font outline.

But this process requires that all the .ttf files should be converted using TTX before thay can be used in Flash.
So I investigated a bit more and I found a really useful and really well done java project: TypeCast.
What I’ve done next was just to do a porting of the available java code into Actionscript 3 and it works like a charm! It can read a .ttf file and extracts all the font informations, including all the glyph outlines.

See a demonstration of thie Flex application.

Here you can download the source code:
[attachments docid=1026 force_saveas=”1″ logged_users=”0″]