Greg Pallis
Greg Pallis

Reputation: 257

In Flash CS5, htmlText seems to work differently for textfields I create dynamically (works fine), vs ones I draw with the IDE (doesn't work). Why?

[I just worked this out - I needed to set 'use device fonts'.]

When I initialise a textbox with the following code:

var tf2:TextField = createCustomTextField(10, 50, 400, 22);
tf2.htmlText = '<FONT FACE="Impact"><i>Lorem ipsum</i>';

function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
    var result:TextField = new TextField();
    result.x = x;
    result.y = y;
    result.width = width;
    result.height = height;
    addChild(result);
    return result;
 }

everything works just great, and exactly as you'd expect - I get the requested text in slanted Impact. On the other hand, if I create the textbox using the CS5 IDE, even if I embed Impact (I can't embed Impact italic, because there doesn't seem to be such a thing), I can't get it to italicise at all - the italicized text simply disappears. This is very confusing - what's going on?

I don't think this is the question everyone else keeps asking about the CS4/CS5 shift, but it could conceivably be - sorry if it is!

Upvotes: 0

Views: 349

Answers (1)

david.emilsson
david.emilsson

Reputation: 2331

In Flash CS5 font embedding is managed differently to previous versions.

Click the "Font Embedding..." option under the "Text" menu. This is where you set all the fonts you need to embed, and specify the style(s) you want.

For instance, if you want to embed both the regular style of Impact and the italicized version of the same font, you need to add both of them to the list (and specify what characters they should include).

You then need to specify what fonts to use via, for example, stylesheets.

This link explains in more detail how to use stylesheets to apply (for example) italic versions of embedded fonts to htmlText and how it differs from Flash CS4.

Upvotes: 1

Related Questions