Quantcast
Channel: Jozef Chúťka's blog » embed
Viewing all articles
Browse latest Browse all 10

Unable to Embed Font When Targeting Flash Player 10.1

$
0
0

I am just so stuck on this one. Is anyone able to embed font and use it in TextField when targeting Flash player 10.1 using flex 4.1 SDK? My code is very simple:

package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    public class Test1 extends Sprite
    {
        [Embed(source="arial.ttf", fontName="Arial", mimeType='application/x-font')]
        public static const FONT_ARIAL:Class;
        
        public function Test1()
        {
            var tf:TextField = new TextField();
            tf.text = "Hallo";
            tf.embedFonts = true;
            tf.defaultTextFormat = new TextFormat("Arial", 10);
            addChild(tf);
        }
    }
}

font file (.ttf) can be downloaded here. When I try to export the movie I see nothing but white. Actualy it seems like no matter what sdk nor flash player version I target, it still does not render text :-( what is going on flashplayer?

Mistery solved!, you have to set defaultTextFormat before text. Credits goes to Martin.

Where to go from here:


Viewing all articles
Browse latest Browse all 10

Trending Articles