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