Auto condensing text

Hi everyone

I need to create a text box in AS3 that will be set in size
And when the user types inside the box the text cannot go outside that set length
So if the user enters a longer word the font will be condensed to fit inside that set area
But the font height can’t change, it can only be the width that is condensing

Is this possible?

If someone has the code, or can point me in the right direction where I can learn how to create something like this is would be greatly appreciated

Thanks