7 Replies Latest reply on Nov 5, 2010 2:47 AM by AVeu

    Problem with insertText in SkinnableTextBase

    AVeu Level 1

      Hi!

      I need to use insertText method from SkinnableTextBase class. But I realized that inserting text using this method doesn't update 'text' property (for example in TextInput component). Below is a simple test application:

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication
           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 mx.events.FlexEvent;
      
                     protected function ti_creationCompleteHandler(event:FlexEvent):void
                     {
                          trace("ti.text='" + ti.text + "'");
                          ti.insertText("abc");
                          trace("ti.text='" + ti.text + "'");
                     } 
                ]]>
           </fx:Script>
           
           <s:TextInput id="ti" creationComplete="ti_creationCompleteHandler(event)" />
           
      </s:WindowedApplication>
      
      

      I receive the following output:

      ti.text=''

      ti.text=''

      Am I right, that expected result should be:

      ti.text=''

      ti.text='abc'

      ?

       

      Is it a bug, or a feature, and I should do something else...

       

      Thanks for any answer

       

      Regards,

      Pawel