2 Replies Latest reply on Dec 17, 2007 8:31 PM by JohnLeger

    RichTextEditor controlBar stopped working

    JohnLeger Level 1
      At first the controlBar on my RichTextEditor worked great. Since I added it to my module I have added a lot of code. The problem is when I recently checked the functionality of the controlBar none of the formatting tools work. For instance I can click a color in the colorPicker but it immediately changes back to the default color once I start typing. I can click any of the buttons and they take focus, but nothing happens.

      Note the default for showControlBar is false, because I programatically show it with a LinkButton. Also note that I have tried to deleting...

      focusIn="richTextEditor_setInvalid()"

      But it didn't help at all!

      Here's my code for the two functions associated with the RichTextEditor...

      //Function changes both the backgroundColor of TextInputs and the checkbox images
      private function contactUs_RichTextEditor_Valid():void
      {
      //Sets backgroundColor of textArea to green
      contactUs_RichTextEditor.textArea.setStyle("backgroundColor", backgroundColor_Valid);
      //Changes checkbox image from gray to green
      richTextEditorCheck.source = greenCheckbox_Image;
      }

      //Function changes both the backgroundColor of TextInputs and the checkbox images
      private function contactUs_RichTextEditor_Invalid():void
      {
      //Sets backgroundColor of textArea to red
      contactUs_RichTextEditor.textArea.setStyle("backgroundColor", backgroundColor_Invalid);
      //Changes green or gray checkbox image to red error image
      richTextEditorCheck.source = redError_Image;
      }


      Here's the my validator...

      <mx:StringValidator id="contactUs_RichTextEditorValidator"
      source="{contactUs_RichTextEditor}"
      property="text"
      minLength="2"
      required="true"
      tooShortError="A minimum of 2 characters is required."
      valid="contactUs_RichTextEditor_Valid()"
      invalid="contactUs_RichTextEditor_Invalid()"
      trigger="{contactUs_RichTextEditor}"
      triggerEvent="change"/>


      Here's my code for my RichTextEditor form item...

      <mx:FormItem
      width="100%"
      height="100%"
      textDecoration="normal"
      required="true">

      <mx:RichTextEditor id="contactUs_RichTextEditor"
      styleName="myTextInput"
      width="100%"
      height="186"
      alpha="1.0"
      cornerRadius="0"
      borderStyle="none"
      backgroundAlpha="1.0"
      backgroundColor="#1F1F1F"
      backgroundDisabledColor="#000000"
      borderThickness="0"
      disabledColor="#000000"
      headerHeight="0"
      verticalScrollPolicy="off"
      showControlBar="false"
      focusIn="richTextEditor_setInvalid()">

      </mx:RichTextEditor>

      </mx:FormItem>
        • 1. Re: RichTextEditor controlBar stopped working
          JohnLeger Level 1
          Okay, this is what I have found! If I delete the following...

          valid="contactUs_RichTextEditor_Valid()"

          ...of out of contactUs_RichTextEditorValidator everything in the RichTextEditor work fine, but this creates another problem.

          The problem is the function this points to is the following...

          //Function changes both the backgroundColor of TextInputs and the checkbox images
          private function contactUs_RichTextEditor_Valid():void
          {
          //Sets backgroundColor of textArea to green
          contactUs_RichTextEditor.textArea.setStyle("backgroundColor", backgroundColor_Valid);
          //Changes checkbox image from gray to green
          richTextEditorCheck.source = greenCheckbox_Image;
          }

          This function is completely formatted like other functions that I have for other TextInputs, which work great! What this function does is that it changes the backgroundColor of the RichTextEditor TextArea to a pale green showing that is has been validated. It also changes a image of a gray checkbox to an image of a green checkbox. All this happens as the user is typing becuase of the trigger and triggerEvent I have set up in the validator. IS THIS A BUG?

          I am using Flex 3 Beta 3.
          • 2. Re: RichTextEditor controlBar stopped working
            JohnLeger Level 1
            I narrowed it down a bit more. If I comment out the following...

            contactUs_RichTextEditor.textArea.setStyle("backgroundColor", backgroundColor_Valid);

            Everything works fine! Except now my RichTextEditor TextArea doesn't turn pale green when validated.

            Here's what the code function looks like with the bit of code above comment out...

            //Function changes both the backgroundColor of TextInputs and the checkbox images
            private function contactUs_RichTextEditor_Valid():void
            {
            //Sets backgroundColor of textArea to green
            //contactUs_RichTextEditor.textArea.setStyle("backgroundColor", backgroundColor_Valid);
            //Changes checkbox image from gray to green
            richTextEditorCheck.source = greenCheckbox_Image;
            }

            This would appear to be a bug to me! As a work around I tried taking the code that I commented out an putting it in its own function wrapped in an if statement...

            BUT it did the same thing. It would appear the changing the backgroundColor of the RichTextEditor TextArea causes the controlBar to malfunction.

            Any HELP would be appreciated!