ActionScript 3.0 Insert font - no text displayed

I am creating dynamic TextFields in actionscript 3.0. Like many others, my text disappears when I set.embedFonts = true;

ArialSlim is built in and exported for actionscript. I have successfully tested withtrace(Font.enumerateFonts());

Interestingly, when I comment out the inline line (as shown below) the font works correctly.

Alternatively .setTextFormat();

also works correctly without a string .embedFonts

.

So my questions are why? Will I face any problems in this case?

var divArray = new Array();
var x_Lbl_Array:Array = new Array();

var entries:int = 10;

var labelFormat:TextFormat = new TextFormat();
var arial:Font = new ArialSlim();    

labelFormat.font = arial.fontName;
labelFormat.size = 10;

var xVar:int = 0;

for(var loop:int = 0; loop < entries; loop++){
    x_Lbl_Array[loop] = new TextField();

    //x_Lbl_Array[loop].embedFonts = true;
    x_Lbl_Array[loop].antiAliasType = AntiAliasType.NORMAL;
    x_Lbl_Array[loop].defaultTextFormat = labelFormat;

    x_Lbl_Array[loop].x = xVar;
    x_Lbl_Array[loop].y = 165;
    x_Lbl_Array[loop].text = "test";

    mc.addChild(x_Lbl_Array[loop]);
    xVar++;
}

      

Edit: I just ran this code from frame 1 with .embedFonts = true;

and it worked ...

Perhaps I should mention that I am having a problem running this code in a method inside an instance of the actioncript class. The class is located in an external .as file. Does this help answer my question?

+3


source to share


2 answers


It turns out that at some point I pressed the "TLF (DF4)" button in the format settings for the embedded font. When I fixed this and selected "Classic (DF3)" it fixed my problem.

I guess I'm really weird that the font was showing correctly if .embedFonts

not set totrue



Thank you Daniel. I appreciate the help.

+1


source


I tried my code and it worked for me (with embedded font)



check if all symbols are included. You can either specify a range of characters or create a text box with all characters.

+1


source







All Articles