0 Replies Latest reply on Jan 5, 2012 7:37 AM by DanZis

    Problem programmaticaly setting chosen color within rich text control

    DanZis

      Hi

       

      On this page http://livedocs.adobe.com/flex/3/html/help.html?content=textcontrols_10.html

       

      An example is given for "Setting RichTextEditor subcontrol properties and styles".

      The code "rte1.colorPicker.selectedIndex=27" does set the colour in the colorPicker control, but when you then start typing text in the textArea, it still uses the old colour?

       

      Here's a copy of the code:

       

      <?xml version="1.0"?>

      <!-- textcontrols/RTESubcontrol.mxml -->

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

           height="420">

        <!-- The RichTextEditor control. To set the a subcontrol's style or property, fully qualify the control ID. The footerColors style sets the ControlBar colors. -->

        <mx:RichTextEditor id="rte1"

           backgroundColor="#ccffcc"

           headerColors="[#88bb88, #bbeebb]"

           footerColors="[#bbeebb, #88bb88]"

           title="Rich Text Editor"

           creationComplete="rte1.textArea.setStyle('backgroundColor','0xeeffee')"

           text="Simple sample text"

        />

          <!-- Button to set a white TextArea background. -->

        <mx:Button

           label="Change appearance"

           click="rte1.textArea.setStyle('backgroundColor', '0xffffff');rte1.colorPicker.selectedIndex=27;"

        />

          <!-- Button to reset the display to its original appearance. -->

        <mx:Button

           label="Reset Appearance"

           click="rte1.textArea.setStyle('backgroundColor', '0xeeffee');rte1.colorPicker.selectedIndex=0;"

        />

      </mx:Application>

       

       

      Thank you