Quirky Flash TextField Fix

Justin | ActionScript,Animate/Flash | Friday, August 24th, 2012

I just encountered an issue with (classic) dynamic and input TextFields in Flash with ActionScript 3. I was able to resolve it, but couldn’t find the solution online, so I’m posting mine in case anyone else is searching for an answer to this problem.

The Problem: The baseline of the TextFields (with an embedded font) is shifted up for some reason, but there doesn’t seem to be a way to control it with styling. In some cases, when capital letters are typed in or assigned to the TextField, the top of the letters are cropped off by the upper border of the TextField.

The Solution: Trick Flash into rendering the TextFields slightly differently. Setting the rotation to .01 worked pretty well, but shifted the first letter in the field upward in some cases. Then I thought cacheAsBitmap might work…no go. I finally settled on assigning the scaleY of the TextField to 1.01, which works perfectly and doesn’t noticeably alter the design.

Get updates from Ajar Productions

Splittext_id_400px

Sign up today and get the InDesign Split Text premium extension for free!

Unsubscribe at any time. Powered by ConvertKit

Related Articles

2 thoughts on “Quirky Flash TextField Fix”

  1. Mark ramsey says:

    If you can style it, setting leading might do something. I’ve had to create new classes & resize the bounding box of textfields using getLineMetrics(). You could also give it a border, then set the border color to your background color – if this works with your design. Embedding also can take care of some of these issues.

  2. Justin says:

    Hi Mark,
    These are smart suggestions!
    In this case, there were a few limitations:
    1. I was working with textfields already on Stage (and on many frames), so custom classes were out…a great approach otherwise.
    2. The border matching the background is very clever, but some of the textfields in this project already had a border and that needed to stay as is.
    3. The font was embedded. This may have been a quick of that font, but it needed to be used for brand consistency.

    I’m glad you posted these ideas, because they will probably work for many people who looking for solutions.

Leave a Reply

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