Inline fonts that do not appear in text fields created by ActionScript

I would like a preface to this wall of text, saying that I am very new to this. Perhaps I missed something obvious.

I am working in Flash CS5 with Actionscript 3. I am trying to use actioncript to create a text field and populate it with text. I put my font into my project using the "Font Embedding" window. However, when the code to create the text field is run, if "embedFont = true;", the font is invisible. The cursor is still changing when it runs over it, so I know it there. At least this is a text box. Dynamic text fields with embedded text that are already on the scene appear to be unaffected.

I tried changing the format of the embedded fonts, not working. I tried to directly insert the font with the "embed" tag using actionscript, but it doesn't seem to work with CS5, or I don't know what I'm doing. As you can see in the code above, I tried to "register" the font without success. I tried using:

var font:Font = new screenfont(); //"screenfont" is the name from Embedding Fonts    

var format:TextFormat = new TextFormat();

format.font = screenfont.fontName;

No dice.

I followed various implementation tutorials and came across a lot of conflicting, confusing information. I read several different posts related to this topic, but have not yet found any viable solutions.

Here is a simple version of my code where “screenfont” is the name specified in the Font Embedding window:

Font.registerFont(screenfont);

            //TextFormat
var listformat:TextFormat = new TextFormat();

listformat.align = TextFormatAlign.LEFT;
listformat.size = 20.8;
listformat.color = 0x0DAC54;
listformat.font="Fixedsys Excelsior 3.01";


           //TextField
var photolist:TextField = new TextField();
    photolist.x = photos_x;
    photolist.y = tempY;
    photolist.width = photos_wdth;
    photolist.height = photos_hght;
    photolist.text = photoname;

    photolist.embedFonts = true; //<--- This freakin' guy!

    photolist.antiAliasType = AntiAliasType.ADVANCED;
    photolist.defaultTextFormat=listformat;
    photolist.selectable = false;
    photolist.wordWrap =  true;

    mediapage.photos.addChild(photolist);

I hope this gives a clear picture.

So, how exactly is it being implemented in CS5?

+5
source share
1

, . , photolist.text = photoname; .

var photolist:TextField = new TextField();
photolist.x = photos_x;
photolist.y = tempY;
photolist.width = photos_wdth;
photolist.height = photos_hght;

photolist.embedFonts = true; 
photolist.antiAliasType = AntiAliasType.ADVANCED;
photolist.defaultTextFormat=listformat;
photolist.selectable = false;
photolist.wordWrap =  true;
photolist.text = photoname;//<-- set text only after applying all formatting and embedding

mediapage.photos.addChild(photolist);
+4

All Articles