0 Replies Latest reply on Oct 27, 2009 8:03 AM by morpheus_bd

    Possible Bug With RichTextEditor

    morpheus_bd

      Hi I have noticed that I might have found a possible bug with the RichTextEditor I am also wondering if I am doing something wrong here.

       

      In this code I have created a basic RichTextEditor with two callbacks one when the mouse movies over and one when the mouse moves out to display a control bar. The Idea for this code I had found on the internet.

       

      The problem comes when the last two lines are executed. Note: The reason why I have writen this like this was to expose the issue that I am having.

                      this.removeAllChildren();
                       this.addChild(mainRTE);

       

      Thus if I remove the RichTextEditor child and re-add it the control bar does not display anymore. Where as I would think that if I just re-added this that it would just display properly as well as having the control bar appear and disapear.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]" applicationComplete="init();">
          <mx:Script>
              <![CDATA[
                  import mx.controls.RichTextEditor;
             
                  public var mainRTE:RichTextEditor;
                 
             
                  public function init():void {
                      mainRTE = new RichTextEditor();
                     
                      mainRTE.x = 20;
                      mainRTE.y = 20;
                      mainRTE.width = 300;
                      mainRTE.height = 400;
                     
                      this.addChild(mainRTE);
                      mainRTE.addEventListener(MouseEvent.MOUSE_OVER,mouseIn);
                      mainRTE.addEventListener(MouseEvent.MOUSE_OUT,mouseOut);
                      this.removeAllChildren();
                      this.addChild(mainRTE);
                  }
                 
                  public function mouseIn(evt:Event):void {
                      mainRTE.showControlBar = true;
                  }
                 
                  public function mouseOut(evt:Event):void {
                      mainRTE.showControlBar = false;
                  }
              ]]>
          </mx:Script>
      </mx:Application>