I don't know if that will be 100% accurate since I think it uses TextField
to measure and TextLine can in Spark can be slightly different.

-Alex

On 3/11/14 3:50 PM, "Justin Mclean" <[email protected]> wrote:

>Hi,
>
>Something like this help?
>
><?xml version="1.0" encoding="utf-8"?>
><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
>                          xmlns:s="library://ns.adobe.com/flex/spark"
>                          xmlns:mx="library://ns.adobe.com/flex/mx">
>       <fx:Script>
>               <![CDATA[
>                       import spark.events.TextOperationEvent;
>                       
>                       protected function 
> changeWidth(event:TextOperationEvent):void
>                       {
>                               var textMetrics:TextLineMetrics = 
> ti.measureText(ti.text);
>                               var textWidth:int = textMetrics.width;
>                               
>                               ti.width = Math.max(30, textWidth+10);
>                       }
>                       
>               ]]>
>       </fx:Script>
>       
>       <s:TextInput id="ti" width="30" change="changeWidth(event)" />
>       
></s:Application>
>
>
>Justin

Reply via email to