Correcting Alert component size for embedded fonts

The Alert component sizes itself based on content and doesn’t respond to setSize calls. However, the sizing doesn’t take embedded fonts into account and cuts off text when using embedded fonts.

To fix this bug we need to add two lines, one to mx.controls.alertClasses.AlertForm and another to mx.core.ext.UIObjectExtensions.

First in mx.controls.alertClasses.AlertForm find the getSize() function and add this line right before all of the current textMeasure_mc references.

textMeasure_mc.embedFonts = tf["embedFonts"];

Then in mx.core.ext.UIObjectExtensions find the TextFormat.prototype.getTextExtent2 mixin and add this line right after (and outside) the if statement.

_root._getTextExtent.embedFonts = this["embedFonts"];

If this bug is affecting you, you can choose to either make these changes directly to the core classes or create a local copy of the classes and change those, with a reference to them in each FLA’s classpath.

This entry was posted in Uncategorized by Sam. Bookmark the permalink.

5 thoughts on “Correcting Alert component size for embedded fonts

  1. Hello.

    I’have modified the file and the with notepad and saved them.
    I has not work.
    Should’nt be tf2[“embedFonts”) ?

    I’ve tried it, aswell and I havent got any solution.

    Did I miss something?


  2. I too tried the modifications listed with no luck… Added the 2 modifications as listed to the correct files and nothing…

    I even deleted the component from my library and re-attached it.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>