# How can I get the smallest possible rectangle around a TextField?

**URL:** <https://forum.kirupa.com/t/how-can-i-get-the-smallest-possible-rectangle-around-a-textfield/299096>\
**Category:** flash\
**Created:** [October 29, 2009, 5:43pm UTC](https://forum.kirupa.com/t/how-can-i-get-the-smallest-possible-rectangle-around-a-textfield/299096 "2009-10-29T17:43:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsoldi](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jsoldi](https://forum.kirupa.com/u/jsoldi)\
**Post date:** [October 29, 2009, 5:43pm UTC](https://forum.kirupa.com/t/how-can-i-get-the-smallest-possible-rectangle-around-a-textfield/299096/1 "2009-10-29T17:43:37Z")

</div>

I want to make a box just like the one on [_this_](http://www.box.net/shared/lby0as9v2m) picture. That’s a screen shot from an app made with Flex, which proves it’s possible to do. I’ve been drawing boxes using the sizes I get from calling functions like getLineMetrics and textHeight, but the box is always to big (vertically). Anyone know how to achieve this?
