4 Replies Latest reply on Nov 14, 2011 8:17 PM by sodeypunk

    RichEditableText width property is not updated

    sodeypunk

      Hi guys, here's my problem.

       

      I have a RichEditableText control that i use for user input. The user has the option to change the font and font size of the input. When a new font or font size is chosen, the width of the input text is larger or smaller and therefore the width of the RichEditablText control also changes.

       

      However, if i do a call for the width property, it has not updated. Only on the next font or font size change does it get updated, but it is the width is of the previous size, not the current one. Code example below. How do i force it to update its width property in accordance with the current/actual width?

       

       

      <fx:Script>

              <![CDATA[

          

           public exampleFunction()

           {

                trace("Width: " + richtext1.width);   //this gives 130

       

                richtext1.setStyle("fontSize", 44);  //increase the font size, therefore the current text gets larger and so does the RichEditableText control's width

          

                trace("Width: " + richtext1.width)  //however, the width property still says 130??    

           }

            

              }

              ]]>

          </fx:Script>

       

       

      <mx: RichEditableText id="richtext1" text="example">

       

      Thanks guys