CURRENT PROJECTS
loading
CATEGORIES AND POSTS
loading
overset
DEVELOPMENT LOG FOR JIM PALMER
Posted 07/11/2006 in flash


I found this issue with changing TextField.text on a TextField.type = "dynamic" with embedded fonts. Basically the text was rendered the first time correctly from the actionscript with a TextFormat applied to the TextField with an embedded font setup correctly. When attempting to rewrite the TextField.text property upon an event or the like, it appeard that the text just disappeared - similar to when the non-device font is not embedded properly.

The solution is to use this rouge, but documented, function called TextField.setNewTextFormat(). When setting the newly created TextFormat object to a TextField object of type dynamic or input, I use something like the following:
this.createTextField("btn", this.getNextHighestDepth(), 0, 0, width, height);
this["btn"].border = false;
this["btn"].type = "dynamic";
this["btn"].html = false;
this["btn"].embedFonts = true;
this["btn"].multiline = false;
this["btn"].mouseWheelEnabled = false;
this["btn"].background = false;
this["btn"].selectable = false;
this["btn"].wordWrap = false;
var btnTxtFormat:TextFormat = new TextFormat();
btnTxtFormat.font = "PixelFont";
btnTxtFormat.size = 8;
btnTxtFormat.color = 0x808080;
this["btn"].setTextFormat(btnTxtFormat);
this["btn"].setNewTextFormat(btnTxtFormat);
The only function of note is the TextField.setNewTextFormat().
comments
loading
new comment
NAME
EMAIL ME ON UPDATES
EMAIL (hidden)
URL
MESSAGE TAGS ALLOWED: <code> <a> <pre class="code [tab4|tabX|inline|bash]"> <br>
PREVIEW COMMENT
TURING TEST
gravatar