Textfield Question (challenging)

How to calculate(using actionscript) the space remaining in that line of textbox where the text is word wrapped?

see attachment…

Your help is appreciated…