adamzwakk
adamzwakk

Reputation: 709

AS3 TextField doesn't show new text at all even though it's there

I have a textfield in a MovieClip that I'm trying to change out from an external class. It appears to return back as empty on the stage, but if I trace what's inside there it gives me the correct value, it just doesn't show up.

My code is this:

((this.parent.parent.getChildByName('bottomBar') as MovieClip).getChildByName('area_txt') as TextField).text = 'test';

So if I trace "((this.parent.parent.getChildByName('bottomBar') as MovieClip).getChildByName('area_txt') as TextField).text" it returns "test" but it doesn't display on the stage, it's just blank.

Any idea what's going on?

Upvotes: 0

Views: 1588

Answers (1)

Daniel
Daniel

Reputation: 35684

The font needs to be embedded, also a bit of a sidenote if you're using defaultTextFormat function you need to call it before setting the text, if you use setTextFormat then you do it after

textfield.embedFonts          = true;
textfield.defaultTextFormat   = format;          // option 1
textfield.text                = "Hello World";
textfield.setTextFormat (format);                // option 2

Upvotes: 1

Related Questions