0 Replies Latest reply on Mar 15, 2010 12:12 PM by Groovee2010

    Problem with RichText control, colored text, and transitions

    Groovee2010

      I have a simple item renderer for a List control which utilizes a RichText control in order to allow bolding, italics, line breaks, etc.

       

      The renderer (whose code follows) came directly from a google search. Not sure if it came from this forum or not. I then extended the renderer to set the color property of the RichText. This also worked fine until I noticed that the text flickers like crazy when performing transitions that involve the List control. If I remove the usage of the color property, or if set the text property instead of the textFlow property, there is no flicker.

       

      I was able to work around the issue by handling the font color within the rich text content, which is a more consistent and extendable approach anyway. But I'm wondering if anyone has insight (for future edification) as to why this flicker would be occurring only in the one scenario.

       

      Thanks,

       

      Lance (Groovee2010)

       

      custom item renderer follows:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          focusEnabled="false">

      <fx:Script>
        <![CDATA[
         import flashx.textLayout.conversion.TextConverter;
        
         override public function set data(item:Object):void
         {
          var displayText:String = '<b>bold text</b><br><i>italicized text</i>'; 
         
          super.data = item;
          super.label = displayText;
          labelElement.textFlow =  TextConverter.importToFlow(displayText, TextConverter.TEXT_FIELD_HTML_FORMAT);
         }

        ]]>
      </fx:Script>

      <s:RichText id="labelElement" color="red" left="6" top="3" verticalAlign="middle" lineBreak="explicit" />

      </s:ItemRenderer>